diff --git a/tests/test_runners.py b/tests/test_runners.py index 7fbaca25..991d10ab 100644 --- a/tests/test_runners.py +++ b/tests/test_runners.py @@ -17,7 +17,7 @@ import pytest -from loopzero import sandbox, worktree +from loopzero import runners, sandbox, worktree from loopzero.runners import ( REVIEW_SCHEMA, RunnerAuthFailed, @@ -113,8 +113,17 @@ def _bwrap_argv(log: Path) -> list[str]: @pytest.fixture(autouse=True) -def fake_bwrap(fake_tool, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path: - for name in ("ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN", "OPENAI_API_KEY"): +def fake_bwrap(fake_tool, tmp_path: Path, tmp_path_factory, monkeypatch: pytest.MonkeyPatch) -> Path: + # Keep reviewer state outside tmp_path, which many tests mount as the checkout. + home = tmp_path_factory.mktemp("reviewer-home") + monkeypatch.setenv("HOME", str(home)) + for name in ( + "CODEX_HOME", + "CLAUDE_CONFIG_DIR", + "CLAUDE_SECURESTORAGE_CONFIG_DIR", + *runners.CLAUDE_AUTH_ENV, + *runners.CODEX_AUTH_ENV, + ): monkeypatch.delenv(name, raising=False) log = tmp_path / "review-bwrap.argv" fake_tool("bwrap", FAKE_BWRAP.format(log=log))