diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-16 17:50:19 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-16 17:50:19 +0000 |
| commit | 5b55b38f0568e7514a3cda6a8d8698cd0aab813b (patch) | |
| tree | f05ef5669db0060638571feaab3051a40982fc84 /tests/test_runner.py | |
| parent | 565b835ea0d45576e797dbe131c218f88fe9cff3 (diff) | |
test(harness): port harness self-tests to Perl
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_runner.py')
| -rw-r--r-- | tests/test_runner.py | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/tests/test_runner.py b/tests/test_runner.py deleted file mode 100644 index 9558175..0000000 --- a/tests/test_runner.py +++ /dev/null @@ -1,44 +0,0 @@ -"""Small contract checks for the test harness, including intentional failures.""" - -from pathlib import Path -import subprocess -import sys -import tempfile -import unittest - -from run import Commands, Failure, check_diagnostics, check_result, compare - - -class HarnessTests(unittest.TestCase): - def test_strict_output(self): - compare(b"a\nb\n", b"a\r\nb\r\n", "stdout") - for actual in [b"a\nb", b"a \nb\n", b"A\nb\n", b"a\n\nb\n"]: - with self.assertRaises(Failure): - compare(b"a\nb\n", actual, "stdout") - - def test_exit_and_stderr(self): - for code, stderr in [(1, b""), (-11, b""), (0, b"unexpected")]: - with self.assertRaises(Failure): - check_result(subprocess.CompletedProcess([], code, b"ok\n", stderr), b"ok\n") - - def test_reason_and_location_must_share_a_diagnostic(self): - expected = [{"reason": "Expected ':'", "line": 3}] - check_diagnostics(subprocess.CompletedProcess([], 1, b"", - b"error: Expected ':' at line 3\ncompilation terminated.\n"), expected) - for diagnostic in [b"error: Expected ':' at line 4", b"error: Expected ':'", - b"error: Expected ':' at line 30\nerror: unrelated at line 3"]: - with self.assertRaises(Failure): - check_diagnostics(subprocess.CompletedProcess([], 1, b"", - diagnostic + b"\ncompilation terminated.\n"), expected) - - def test_timeout_is_failure_and_saved(self): - with tempfile.TemporaryDirectory() as temporary: - directory = Path(temporary) - with self.assertRaisesRegex(Failure, "timed out"): - Commands(directory).run([sys.executable, "-c", "import time; time.sleep(5)"], - directory, timeout=0.05) - self.assertIn('"timeout_expired": true', (directory / "01.json").read_text()) - - -if __name__ == "__main__": - unittest.main() |
