test: stop reloading modules, so the suite passes in any order

- default_config.build_default_config gives the defaults with the environment as it is now; the overlay tests call it instead of reloading the module, whose reloaded DEFAULT_CONFIG leaked their settings into later tests
- the Ollama and API-key tests import the modules they check, which read the environment when called; two tests that only read os.environ are dropped
This commit is contained in:
Yijia-Xiao
2026-09-29 05:57:18 +00:00
parent 9a568d19b1
commit fa87947c33
8 changed files with 201 additions and 258 deletions
+3 -5
View File
@@ -67,12 +67,10 @@ def test_case_insensitive_lookup():
@pytest.fixture
def prompts(monkeypatch):
"""Import cli.prompts with a fresh environment so module-level state is consistent."""
import importlib
def prompts():
"""cli.prompts, which reads the environment when it is called."""
import cli.prompts as prompts_module
return importlib.reload(prompts_module)
return prompts_module
def test_ensure_api_key_returns_existing(monkeypatch, prompts):