Name a signal kill, match the judge's retry line, state worker failure in --help
This commit is contained in:
@@ -283,10 +283,11 @@ class RunWorker(unittest.TestCase):
|
||||
"": 'print(json.dumps({"type": "result"}))',
|
||||
"claude exited 0 without a result event": 'print(json.dumps({"type": "assistant", "message": {"content": [{"type": "text", "text": "worked"}]}}))',
|
||||
"claude exited 3": "sys.exit(3)",
|
||||
"claude killed by signal 9": "os.kill(os.getpid(), 9)",
|
||||
}
|
||||
with unittest.mock.patch.dict(os.environ, {"PATH": f"{bin}:{os.environ['PATH']}"}), unittest.mock.patch.object(sys, "stdout", io.StringIO()):
|
||||
for failure, script in scripts.items():
|
||||
open(stub, "w").write(f"#!/usr/bin/env python3\nimport json\nimport sys\n{script}\n")
|
||||
open(stub, "w").write(f"#!/usr/bin/env python3\nimport json\nimport os\nimport sys\n{script}\n")
|
||||
os.chmod(stub, 0o700)
|
||||
self.assertEqual(loop.run_worker([]), failure)
|
||||
|
||||
@@ -360,7 +361,7 @@ class Main(unittest.TestCase):
|
||||
sleep = stack.enter_context(unittest.mock.patch("time.sleep"))
|
||||
with self.assertRaises(SystemExit) as stopped:
|
||||
loop.main()
|
||||
self.assertIn("the worker failed: claude exited 3 - retrying in a minute", sys.stderr.getvalue())
|
||||
self.assertIn("retrying the worker in a minute: claude exited 3", sys.stderr.getvalue())
|
||||
self.assertEqual(sleep.call_count, 2)
|
||||
self.assertEqual(stopped.exception.code, "the worker failed three times running: claude exited 3")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user