From 7a6eb36b67663da75568a651ebdf6b9e7fdf6d20 Mon Sep 17 00:00:00 2001 From: Anonymous78e <123822114+Anonymous78e@users.noreply.github.com> Date: Wed, 25 Nov 2026 01:01:02 +0100 Subject: [PATCH] tests: the quick-program GPU timeout case no longer races Python startup (TEST-GPU-TIMEOUT-QUICK-LOAD) test_quick_program_is_unaffected ran `python -c "print('ok')"` under the 0.5 s limit the hang cases use. On a loaded Windows host starting the child alone can take longer, so the quick program was killed and the test failed for the wrong reason (3 of 10 runs with the CPU saturated). That one case now runs under a 60 s limit, still a limit; the hang cases keep 0.5 s. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014sDZDAAcsauTL6d8ie67Qo --- tests/test_gpu_test_timeout.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_gpu_test_timeout.py b/tests/test_gpu_test_timeout.py index d290862ee9..a0420f925d 100644 --- a/tests/test_gpu_test_timeout.py +++ b/tests/test_gpu_test_timeout.py @@ -99,9 +99,13 @@ def fake_run(cmd: list[str], **kwargs: object) -> subprocess.CompletedProcess[st self.assertIn("0/1 passed", out.getvalue()) def test_quick_program_is_unaffected(self): - self.assertEqual(run_gpu_tests.run_cmd(QUICK), (0, "ok")) - rc, out = check.run(*QUICK) - self.assertEqual((rc, out.strip()), (0, "ok")) + # A limit is still in force, but not the hang cases' 0.5 s: starting a Python child alone can take longer than + # that on a loaded Windows host, which killed the quick program and failed this test for the wrong reason. + with patch.dict(os.environ, {"LEONIDA_GPU_TEST_TIMEOUT": "60"}): + self.assertEqual(check.gpu_test_timeout(), 60) + self.assertEqual(run_gpu_tests.run_cmd(QUICK), (0, "ok")) + rc, out = check.run(*QUICK) + self.assertEqual((rc, out.strip()), (0, "ok")) def test_translator_step_has_no_limit(self): seen = {}