Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(tests): clear the network off switches before every unit test (#4444)

Raghav Chamadiya15551674b470
diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py
index d0ee332a7..1c4a7206c 100644
--- a/tests/unit/conftest.py
+++ b/tests/unit/conftest.py
@@ -20,6 +20,19 @@ def cursor_hooks_json(tmp_path_factory, monkeypatch):
return hooks
[email protected](autouse=True)
+def network_switches_off(monkeypatch):
+ """Start every test with the network off switches cleared.
+
+ ``network_disabled()`` short-circuits the PyPI check and agent-CLI probes.
+ A shell ``DO_NOT_TRACK`` or ``uninstall`` writing ``os.environ`` directly
+ would otherwise turn those paths off for later tests. Tests of the gate set
+ the switch themselves.
+ """
+ for var in ("REPOWISE_OFFLINE", "DO_NOT_TRACK", "REPOWISE_TELEMETRY_DISABLED"):
+ monkeypatch.delenv(var, raising=False)
+
+
@pytest.fixture(autouse=True)
def fresh_test_map_cache():
"""In-memory stores reuse one URL and seed graph rows without moving the