Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(devex): keep devbox:setup tests off the network (#130141)

Thiago Salvatore9f0dcb121214
diff --git a/tools/hogli-commands/hogli_commands/tests/test_devbox.py b/tools/hogli-commands/hogli_commands/tests/test_devbox.py
index 004deba2f6d9..a7ed5e549517 100644
--- a/tools/hogli-commands/hogli_commands/tests/test_devbox.py
+++ b/tools/hogli-commands/hogli_commands/tests/test_devbox.py
@@ -71,6 +71,13 @@ def recorded_properties(monkeypatch: pytest.MonkeyPatch) -> dict[str, object]:
return recorded
+def stub_mutagen_setup(monkeypatch: pytest.MonkeyPatch) -> None:
+ monkeypatch.setattr(devbox_mutagen, "ensure_mutagen_installed", lambda **kw: None)
+ monkeypatch.setattr(devbox_mutagen, "ensure_daemon_with_shim", lambda: None)
+ monkeypatch.setattr(devbox_mutagen, "ensure_user_mutagen_config", lambda: Path("/tmp/mutagen.yml"))
+
+
class TestDevboxConfig:
"""Test persisted devbox preferences."""
@@ -2206,7 +2213,9 @@ class TestDevboxCommands:
assert "hogli devbox:update" in result.output
assert "hogli devbox:destroy" in result.output
- def test_devbox_setup_runs_explicit_setup_steps(self, monkeypatch: pytest.MonkeyPatch) -> None:
+ def test_devbox_setup_runs_explicit_setup_steps(
+ self, monkeypatch: pytest.MonkeyPatch, stub_mutagen_setup: None
+ ) -> None:
calls: list[str] = []
monkeypatch.setattr(devbox_cli, "ensure_coder_reachable", lambda setup_hint="": calls.append("reachable"))
@@ -2273,7 +2282,7 @@ class TestDevboxCommands:
]
def test_devbox_setup_threads_resolved_identity_agent_into_ssh_config(
- self, monkeypatch: pytest.MonkeyPatch
+ self, monkeypatch: pytest.MonkeyPatch, stub_mutagen_setup: None
) -> None:
captured: dict[str, object] = {}
@@ -2305,6 +2314,7 @@ class TestDevboxCommands:
self,
monkeypatch: pytest.MonkeyPatch,
devbox_config_path: Path,
+ stub_mutagen_setup: None,
) -> None:
monkeypatch.setattr(devbox_cli, "ensure_coder_reachable", lambda setup_hint="": None)
monkeypatch.setattr(devbox_cli, "ensure_coder_installed", lambda **kw: None)
@@ -2337,6 +2347,7 @@ class TestDevboxCommands:
self,
monkeypatch: pytest.MonkeyPatch,
devbox_config_path: Path,
+ stub_mutagen_setup: None,
) -> None:
devbox_config_path.write_text(json.dumps({"git_name": "Existing User", "git_email": "[email protected]"}))
@@ -2959,7 +2970,7 @@ class TestDevboxOpenHerdr:
@pytest.fixture
-def stub_setup_environment(monkeypatch: pytest.MonkeyPatch) -> None:
+def stub_setup_environment(monkeypatch: pytest.MonkeyPatch, stub_mutagen_setup: None) -> None:
"""No-op every external dependency in ``devbox_setup`` so reset/gate tests can run hermetically."""
for name in ("ensure_coder_reachable", "ensure_coder_authenticated"):
monkeypatch.setattr(devbox_cli, name, lambda *a, **kw: None)