Restore the environment after the model test
This commit was merged in pull request #9.
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user