Skip to content

Commit 7acd7d2

Browse files
committed
test: isolate integration test home
Assisted-by: Codex (model: GPT-5, autonomous)
1 parent b6b74d4 commit 7acd7d2

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/integrations/conftest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
"""Shared test helpers for integration tests."""
22

3+
import pytest
4+
35
from specify_cli.integrations.base import MarkdownIntegration
46

57

8+
@pytest.fixture(autouse=True)
9+
def _isolate_integration_home(monkeypatch: pytest.MonkeyPatch, tmp_path):
10+
"""Keep integration tests from reading or writing the real user home."""
11+
home = tmp_path / "home"
12+
for path in (home, home / ".cache", home / ".config", home / ".local" / "share"):
13+
path.mkdir(parents=True, exist_ok=True)
14+
15+
monkeypatch.setenv("HOME", str(home))
16+
monkeypatch.setenv("USERPROFILE", str(home))
17+
monkeypatch.setenv("XDG_CACHE_HOME", str(home / ".cache"))
18+
monkeypatch.setenv("XDG_CONFIG_HOME", str(home / ".config"))
19+
monkeypatch.setenv("XDG_DATA_HOME", str(home / ".local" / "share"))
20+
21+
622
class StubIntegration(MarkdownIntegration):
723
"""Minimal concrete integration for testing."""
824

0 commit comments

Comments
 (0)