Isolate git environment for all tests
Move the _isolated_git fixture to tests/conftest.py so git rebase --exec cannot leak GIT_DIR into any test; add a test outside tests/evals. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ecf4ec4e8a
commit
4bcb1d6596
3 files changed
+36
-16
No files matched your search
@@ -1,16 +0,0 @@
|
||||
import pytest
|
||||
|
||||
from chemenu.evals.baseline import GIT_REPO_ENV
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _isolated_git(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Keep git in tests away from the repository running them.
|
||||
|
||||
`git rebase --exec` and hooks export GIT_DIR; without this, `git init` and
|
||||
`git commit` in a test would act on the checkout itself.
|
||||
"""
|
||||
for name in GIT_REPO_ENV:
|
||||
monkeypatch.delenv(name, raising=False)
|
||||
monkeypatch.setenv("GIT_CONFIG_GLOBAL", "/dev/null")
|
||||
monkeypatch.setenv("GIT_CONFIG_NOSYSTEM", "1")
|
||||
Reference in new issue
Block a user