diff --git a/bin/test_loop_claude.py b/bin/test_loop_claude.py index 88d4ec5e..5d13e0b3 100644 --- a/bin/test_loop_claude.py +++ b/bin/test_loop_claude.py @@ -6,6 +6,7 @@ import pathlib import stat import tempfile import unittest +import unittest.mock import uuid SESSION_ID = str(getattr(uuid, "uuid7", uuid.uuid4)()) @@ -67,13 +68,11 @@ class WorkerArgs(unittest.TestCase): self.assertNotIn("paint the fence", args[1]) def test_the_project_settings_pick_the_model_unless_the_environment_names_one(self): - os.environ.pop("WORKER_MODEL", None) - self.assertNotIn("--model", loop.worker_args("t", "n", SESSION_ID, resuming=False)) - os.environ["WORKER_MODEL"] = "claude-fable-5-1" - try: + with unittest.mock.patch.dict(os.environ): + os.environ.pop("WORKER_MODEL", None) + self.assertNotIn("--model", loop.worker_args("t", "n", SESSION_ID, resuming=False)) + with unittest.mock.patch.dict(os.environ, {"WORKER_MODEL": "claude-fable-5-1"}): args = loop.worker_args("t", "n", SESSION_ID, resuming=False) - finally: - del os.environ["WORKER_MODEL"] self.assertEqual(args[args.index("--model") + 1], "claude-fable-5-1")