Skip to content

Commit 296fa81

Browse files
authored
Mock config env variables (#3621)
1 parent a2d94c9 commit 296fa81

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/unit/test_config.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ def test_env_overrides_compat_toml(monkeypatch, default_config, temp_toml_file):
227227
monkeypatch.setenv('WORKSPACE_BASE', 'UNDEFINED')
228228
monkeypatch.setenv('SANDBOX_TIMEOUT', '1000')
229229
monkeypatch.setenv('SANDBOX_USER_ID', '1002')
230+
monkeypatch.delenv('LLM_MODEL', raising=False)
230231

231232
load_from_toml(default_config, temp_toml_file)
232233

@@ -279,6 +280,7 @@ def test_env_overrides_sandbox_toml(monkeypatch, default_config, temp_toml_file)
279280
monkeypatch.setenv('WORKSPACE_BASE', 'UNDEFINED')
280281
monkeypatch.setenv('SANDBOX_TIMEOUT', '1000')
281282
monkeypatch.setenv('SANDBOX_USER_ID', '1002')
283+
monkeypatch.delenv('LLM_MODEL', raising=False)
282284

283285
load_from_toml(default_config, temp_toml_file)
284286

@@ -305,7 +307,7 @@ def test_env_overrides_sandbox_toml(monkeypatch, default_config, temp_toml_file)
305307
assert default_config.workspace_mount_path == os.getcwd() + '/UNDEFINED'
306308

307309

308-
def test_sandbox_config_from_toml(default_config, temp_toml_file):
310+
def test_sandbox_config_from_toml(monkeypatch, default_config, temp_toml_file):
309311
# Test loading configuration from a new-style TOML file
310312
with open(temp_toml_file, 'w', encoding='utf-8') as toml_file:
311313
toml_file.write(
@@ -322,7 +324,7 @@ def test_sandbox_config_from_toml(default_config, temp_toml_file):
322324
user_id = 1001
323325
"""
324326
)
325-
327+
monkeypatch.setattr(os, 'environ', {})
326328
load_from_toml(default_config, temp_toml_file)
327329
load_from_env(default_config, os.environ)
328330
finalize_config(default_config)

0 commit comments

Comments
 (0)