Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

test(conftest): patch get_vibe_remote_dir directly so fallback path remains testable

cyhf99e5a172185
diff --git a/tests/conftest.py b/tests/conftest.py
index c2e88c0d3..0cea666bc 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -2,7 +2,7 @@
Per AGENTS.md ("Tests and probes must never mutate the current local
environment or live user state"), every test runs against an isolated
-``VIBE_REMOTE_HOME`` so config writes, state files, and runtime markers can
+data directory so config writes, state files, and runtime markers can
never leak into the developer's real ``~/.vibe_remote/`` directory.
Historically a handful of install / upgrade tests mocked
@@ -11,13 +11,24 @@ Historically a handful of install / upgrade tests mocked
The post-install bookkeeping in ``vibe.api._run_install_command`` then
called ``load_config()`` / ``cfg.save()`` against the real config.json and
persisted the fixture path, surfacing in the UI after the next restart.
+
+We monkeypatch ``paths.get_vibe_remote_dir`` rather than the underlying
+``VIBE_REMOTE_HOME`` env var because the env-var fallback branch is
+itself covered by the suite — ``test_v2_paths.py::test_paths_are_under_home``
+asserts that, with ``VIBE_REMOTE_HOME`` unset, ``get_vibe_remote_dir()``
+falls back to ``Path.home() / '.vibe_remote'``. Patching the function
+keeps that fallback observable while still isolating writes, and the
+``.vibe_remote`` suffix on the patched path keeps ``root.name`` matching
+the production value so structural assertions on the path tree pass.
"""
from __future__ import annotations
import pytest
+from config import paths
+
@pytest.fixture(autouse=True)
def _isolate_vibe_remote_home(tmp_path, monkeypatch):
- monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / "vibe_remote_home"))
+ monkeypatch.setattr(paths, "get_vibe_remote_dir", lambda: tmp_path / ".vibe_remote")
diff --git a/tests/test_ui_api.py b/tests/test_ui_api.py
index c31959851..752e35157 100644
--- a/tests/test_ui_api.py
+++ b/tests/test_ui_api.py
@@ -161,9 +161,7 @@ def test_detect_cli_finds_codex_in_npm_global_prefix(monkeypatch, tmp_path):
assert result["path"] == str(codex_path)
-def test_install_agent_returns_resolved_path(monkeypatch, tmp_path):
- monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / "vibe_remote_home"))
-
+def test_install_agent_returns_resolved_path(monkeypatch):
class CompletedProcess:
returncode = 0
stdout = "installed"
@@ -183,9 +181,7 @@ def test_install_agent_returns_resolved_path(monkeypatch, tmp_path):
assert result["path"] == "/Users/test/.opencode/bin/opencode"
-def test_install_codex_uses_resolved_npm(monkeypatch, tmp_path):
- monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / "vibe_remote_home"))
-
+def test_install_codex_uses_resolved_npm(monkeypatch):
calls = []
class CompletedProcess:
@@ -231,8 +227,6 @@ def test_discord_list_channels_rejects_empty_guild_id(monkeypatch):
def test_install_codex_detects_binary_via_npm_prefix(monkeypatch, tmp_path):
- monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / "vibe_remote_home"))
-
npm_path = tmp_path / "node" / "bin" / "npm"
npm_path.parent.mkdir(parents=True, exist_ok=True)
npm_path.write_text("#!/bin/sh\n")