From 832e5fa048ccf537a96538613cfdde7b200c91c4 Mon Sep 17 00:00:00 2001 From: the_og Date: Sat, 4 Jul 2026 13:12:04 -0400 Subject: [PATCH] fix: bump spawn-test timeouts to avoid CI flakiness (closes #12) The crashed/exited/stderr spawn tests used 0.3-0.5s timeouts. On a slow CI runner, interpreter startup can exceed that, so the process is still starting when the timeout fires, gets killed, and is misclassified "ok" (still running) instead of "crashed"/"exited". Bump those three to 2.0s. The two "ok" paths (sleep-60, stdin-block) stay at 0.3s since timing out there means success. --- tests/test_core.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index bea00a3..aaf2faf 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -256,17 +256,20 @@ def test_spawn_test_ok_still_running(): def test_spawn_test_crashed(): - # A process that exits with a non-zero code immediately + # A process that exits with a non-zero code immediately. + # Timeout is generous (not 0.3s) so a slow CI runner's interpreter startup + # can't outlast it and misclassify the crash as "ok" (still running). See #12. r = c.spawn_test( - {"command": sys.executable, "args": ["-c", "raise SystemExit(1)"]}, timeout=0.3 + {"command": sys.executable, "args": ["-c", "raise SystemExit(1)"]}, timeout=2.0 ) assert r["outcome"] == "crashed" assert r["returncode"] == 1 def test_spawn_test_exited_cleanly(): - # A process that exits 0 before timeout (unusual for a server) - r = c.spawn_test({"command": sys.executable, "args": ["-c", "pass"]}, timeout=0.5) + # A process that exits 0 before timeout (unusual for a server). + # Generous timeout so slow-runner startup can't flip this to "ok". See #12. + r = c.spawn_test({"command": sys.executable, "args": ["-c", "pass"]}, timeout=2.0) assert r["outcome"] == "exited" assert r["returncode"] == 0 @@ -288,7 +291,7 @@ def test_spawn_test_stderr_captured(): "command": sys.executable, "args": ["-c", "import sys; sys.stderr.write('test-err\\n'); sys.exit(2)"], }, - timeout=0.5, + timeout=2.0, ) assert r["outcome"] == "crashed" assert "test-err" in r["stderr"]