From 7acd7d2eda18c815ae8ea72de8e91aa6ec97ae67 Mon Sep 17 00:00:00 2001 From: Pascal Date: Wed, 24 Jun 2026 09:26:34 +0200 Subject: [PATCH] test: isolate integration test home Assisted-by: Codex (model: GPT-5, autonomous) --- tests/integrations/conftest.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/integrations/conftest.py b/tests/integrations/conftest.py index 54f59e23a7..42135402a9 100644 --- a/tests/integrations/conftest.py +++ b/tests/integrations/conftest.py @@ -1,8 +1,24 @@ """Shared test helpers for integration tests.""" +import pytest + from specify_cli.integrations.base import MarkdownIntegration +@pytest.fixture(autouse=True) +def _isolate_integration_home(monkeypatch: pytest.MonkeyPatch, tmp_path): + """Keep integration tests from reading or writing the real user home.""" + home = tmp_path / "home" + for path in (home, home / ".cache", home / ".config", home / ".local" / "share"): + path.mkdir(parents=True, exist_ok=True) + + monkeypatch.setenv("HOME", str(home)) + monkeypatch.setenv("USERPROFILE", str(home)) + monkeypatch.setenv("XDG_CACHE_HOME", str(home / ".cache")) + monkeypatch.setenv("XDG_CONFIG_HOME", str(home / ".config")) + monkeypatch.setenv("XDG_DATA_HOME", str(home / ".local" / "share")) + + class StubIntegration(MarkdownIntegration): """Minimal concrete integration for testing."""