From 6c9792ed11e022014f4c7b468ed37db6e4962d5f Mon Sep 17 00:00:00 2001 From: Dani <93452665+dani1005@users.noreply.github.com> Date: Tue, 28 Jul 2026 22:35:13 -0400 Subject: [PATCH] test(conftest): pin EVEROS_ROOT so tests ignore the developer's config (#369) Settings resolves its TOML source through resolve_root(), so any field a test does not pass explicitly was filled from the real everos.toml on the machine running the suite. Enabling [observability] locally, for instance, made test_returns_singleton_when_configured fail, because the LLM client picks up the usage-recording wrapper when tracing is on: green in CI, red on that developer's machine, and unrelated to whatever they were changing. An autouse fixture now points EVEROS_ROOT at a per-test tmp dir. Tests that exercise root resolution itself already setenv / delenv inside the test body, which runs after the fixture, so none of them needed changing. Claude-Session: https://claude.ai/code/session_01UyKinsWs1MgoARPoB9R4NW Co-authored-by: Claude Opus 5 (1M context) Co-authored-by: zhanghui --- tests/conftest.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index c069c8e..3c7202a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -26,6 +26,23 @@ _FIXTURE_DIR = Path(__file__).resolve().parent / "fixtures" _LONG_CONV_PATH = _FIXTURE_DIR / "long_conversation_locomo_caroline_melanie.json" +@pytest.fixture(autouse=True) +def _isolate_everos_root(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None: + """Pin ``EVEROS_ROOT`` so no test reads the developer's own ``everos.toml``. + + ``Settings`` resolves its TOML source through ``resolve_root()``, so any + field a test does not pass explicitly is filled from the real config file + on the machine running the suite. A developer who has, say, enabled + ``[observability]`` locally then sees failures in tests that assert the + default-off behaviour — green in CI, red on their machine, and unrelated to + whatever they were changing. + + Tests that exercise root resolution itself override this: their own + ``setenv`` / ``delenv`` runs inside the test body, after this fixture. + """ + monkeypatch.setenv("EVEROS_ROOT", str(tmp_path)) + + @pytest.fixture(autouse=True) def _reset_settings_cache() -> Iterator[None]: import structlog