generated from john/python-template
This commit is contained in:
@@ -107,6 +107,22 @@ def test_runtime_settings_uses_override_env_file(tmp_path: Path, monkeypatch):
|
||||
assert "PORT=9001" in target.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_runtime_settings_falls_back_to_shared_settings_env_file_override(tmp_path: Path, monkeypatch):
|
||||
settings = _settings_for_runtime_editing(tmp_path)
|
||||
target = tmp_path / "shared.env"
|
||||
target.write_text("OPENROUTER_API_KEY=test-key\nPORT=8000\n", encoding="utf-8")
|
||||
monkeypatch.delenv("RUNTIME_SETTINGS_ENV_FILE", raising=False)
|
||||
monkeypatch.setenv("ENV_FILE", str(target))
|
||||
|
||||
snapshot = save_runtime_settings(
|
||||
settings=settings,
|
||||
updates={"port": "9001"},
|
||||
)
|
||||
|
||||
assert snapshot.env_file_path == target
|
||||
assert "PORT=9001" in target.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_save_runtime_settings_surfaces_unreadable_target(tmp_path: Path, monkeypatch):
|
||||
settings = _settings_for_runtime_editing(tmp_path)
|
||||
env_path = tmp_path / ".env"
|
||||
|
||||
Reference in New Issue
Block a user