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 stat
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
import unittest.mock
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
SESSION_ID = str(getattr(uuid, "uuid7", uuid.uuid4)())
|
SESSION_ID = str(getattr(uuid, "uuid7", uuid.uuid4)())
|
||||||
@@ -67,13 +68,11 @@ class WorkerArgs(unittest.TestCase):
|
|||||||
self.assertNotIn("paint the fence", args[1])
|
self.assertNotIn("paint the fence", args[1])
|
||||||
|
|
||||||
def test_the_project_settings_pick_the_model_unless_the_environment_names_one(self):
|
def test_the_project_settings_pick_the_model_unless_the_environment_names_one(self):
|
||||||
os.environ.pop("WORKER_MODEL", None)
|
with unittest.mock.patch.dict(os.environ):
|
||||||
self.assertNotIn("--model", loop.worker_args("t", "n", SESSION_ID, resuming=False))
|
os.environ.pop("WORKER_MODEL", None)
|
||||||
os.environ["WORKER_MODEL"] = "claude-fable-5-1"
|
self.assertNotIn("--model", loop.worker_args("t", "n", SESSION_ID, resuming=False))
|
||||||
try:
|
with unittest.mock.patch.dict(os.environ, {"WORKER_MODEL": "claude-fable-5-1"}):
|
||||||
args = loop.worker_args("t", "n", SESSION_ID, resuming=False)
|
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")
|
self.assertEqual(args[args.index("--model") + 1], "claude-fable-5-1")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user