Skip to content

Give your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.

test: isolate pytest from user home

Pnantbe514212aaa6
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 00000000..e64e293b
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+"""Suite-wide containment for tests that exercise user-facing installers."""
+
+import pytest
+
+from agent_reach.config import Config
+
+
[email protected](autouse=True)
+def isolated_home(tmp_path, monkeypatch):
+ """Redirect every common home/config root before each test runs."""
+ home = tmp_path / "home"
+ home.mkdir(mode=0o700)
+ monkeypatch.setenv("HOME", str(home))
+ monkeypatch.setenv("USERPROFILE", str(home))
+ monkeypatch.setenv("XDG_CONFIG_HOME", str(home / ".config"))
+ monkeypatch.setenv("APPDATA", str(home / "AppData" / "Roaming"))
+ monkeypatch.setenv("LOCALAPPDATA", str(home / "AppData" / "Local"))
+ monkeypatch.delenv("OPENCLAW_HOME", raising=False)
+
+ config_dir = home / ".agent-reach"
+ monkeypatch.setattr(Config, "CONFIG_DIR", config_dir)
+ monkeypatch.setattr(Config, "CONFIG_FILE", config_dir / "config.yaml")
+ return home