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) <noreply@anthropic.com>
Co-authored-by: zhanghui <huizhang1995@gmail.com>
This commit is contained in:
Dani 2026-07-28 22:35:13 -04:00 committed by GitHub
parent 4e13f7881e
commit 6c9792ed11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 0 deletions

View File

@ -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