fix: bump spawn-test timeouts to avoid CI flakiness (closes #12)
Build & Release / Build (macOS) (push) Successful in 1m29s
Build & Release / Build (Linux) (push) Successful in 1m1s
Build & Release / Build (Windows) (push) Successful in 1m12s
Build & Release / Publish Release (push) Successful in 10s
CI / Lint (ruff) (push) Successful in 7s
CI / Tests (py3.10) (push) Successful in 10s
CI / Tests (py3.12) (push) Successful in 8s

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.
This commit is contained in:
2026-07-04 13:12:04 -04:00
parent c6c6dfa5bc
commit 832e5fa048
+8 -5
View File
@@ -256,17 +256,20 @@ def test_spawn_test_ok_still_running():
def test_spawn_test_crashed(): 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( 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["outcome"] == "crashed"
assert r["returncode"] == 1 assert r["returncode"] == 1
def test_spawn_test_exited_cleanly(): def test_spawn_test_exited_cleanly():
# A process that exits 0 before timeout (unusual for a server) # A process that exits 0 before timeout (unusual for a server).
r = c.spawn_test({"command": sys.executable, "args": ["-c", "pass"]}, timeout=0.5) # 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["outcome"] == "exited"
assert r["returncode"] == 0 assert r["returncode"] == 0
@@ -288,7 +291,7 @@ def test_spawn_test_stderr_captured():
"command": sys.executable, "command": sys.executable,
"args": ["-c", "import sys; sys.stderr.write('test-err\\n'); sys.exit(2)"], "args": ["-c", "import sys; sys.stderr.write('test-err\\n'); sys.exit(2)"],
}, },
timeout=0.5, timeout=2.0,
) )
assert r["outcome"] == "crashed" assert r["outcome"] == "crashed"
assert "test-err" in r["stderr"] assert "test-err" in r["stderr"]