Pin the archive path, the judge's third failure and the archive count in the tests

This commit is contained in:
2026-09-24 22:18:30 +02:00
parent 42f649bf70
commit 29daccd96b
+7 -4
View File
@@ -60,7 +60,7 @@ class Project(unittest.TestCase):
with unittest.mock.patch.dict(os.environ, {"HOME": "/h"}):
with unittest.mock.patch("os.getcwd", return_value="/h/code/a/b"):
self.assertEqual(loop.session_name(), "A ~/code/a/b auto-mode")
self.assertEqual(loop.project_path(), "code/a/b")
self.assertEqual(loop.project_path(), "a/b")
with unittest.mock.patch("os.getcwd", return_value="/h/code"):
self.assertEqual(loop.session_name(), "A ~/code auto-mode")
self.assertEqual(loop.project_path(), "code")
@@ -189,12 +189,15 @@ class RunRound(unittest.TestCase):
with unittest.mock.patch.dict(os.environ, environment), unittest.mock.patch("time.sleep") as sleep:
for _ in range(3):
self.assertTrue(loop.run_round("task", "premises", "A name", SESSION_ID))
open(verdicts, "w").write("fail fail fail")
with self.assertRaises(SystemExit):
loop.run_round("task", "premises", "A name", SESSION_ID)
starts = [args[args.index("-p") + 1:][:3] for args in map(json.loads, open(calls)) if "--json-schema" not in args]
self.assertEqual([start[1] for start in starts], ["--name", "--resume", "--name"])
self.assertEqual([start[1] for start in starts], ["--name", "--resume", "--name", "--resume"])
self.assertEqual(starts[1][2], SESSION_ID)
self.assertEqual(sleep.call_count, 1)
self.assertEqual(sleep.call_count, 3)
self.assertEqual(open(verdicts).read(), "")
self.assertEqual(len(os.listdir(loop.ARCHIVE)), 1)
[copy] = [name for _, _, names in os.walk(loop.ARCHIVE) for name in names]
class Reload(unittest.TestCase):