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): autouse setenv + uses_real_paths marker opt-out

cyh57ec6bde8efd
diff --git a/pyproject.toml b/pyproject.toml
index 6a8545197..1f7ba666d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -118,6 +118,7 @@ extend-ignore = ["E501"]
asyncio_mode = "auto"
markers = [
"integration: platform integration tests requiring Docker + platform tokens",
+ "uses_real_paths: opt out of the autouse VIBE_REMOTE_HOME isolation so the test can exercise the real config.paths resolver (must remain read-only)",
]
[dependency-groups]
diff --git a/tests/conftest.py b/tests/conftest.py
index 0cea666bc..07de431e9 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -2,8 +2,9 @@
Per AGENTS.md ("Tests and probes must never mutate the current local
environment or live user state"), every test runs against an isolated
-data directory so config writes, state files, and runtime markers can
-never leak into the developer's real ``~/.vibe_remote/`` directory.
+data directory by default, 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
``resolve_cli_path`` to return fixture paths like
@@ -12,23 +13,27 @@ 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.
+Isolation mechanism: we set ``VIBE_REMOTE_HOME`` to a per-test tmp
+directory. This means ``config.paths.get_vibe_remote_dir`` runs as
+written — only its env-var-set branch is exercised under isolation, and
+the function itself is never replaced, so the suite still catches
+regressions in path-resolution logic.
+
+Path-resolution tests (e.g. ``tests/test_v2_paths.py::test_paths_are_under_home``)
+intentionally cover the env-var-unset branch where ``get_vibe_remote_dir``
+falls back to ``Path.home() / '.vibe_remote'``. Those opt out with
+``@pytest.mark.uses_real_paths``, run against the real environment, and
+must remain read-only (they may not call ``cfg.save()`` or otherwise
+write to ``~/.vibe_remote/``).
"""
from __future__ import annotations
import pytest
-from config import paths
-
@pytest.fixture(autouse=True)
-def _isolate_vibe_remote_home(tmp_path, monkeypatch):
- monkeypatch.setattr(paths, "get_vibe_remote_dir", lambda: tmp_path / ".vibe_remote")
+def _isolate_vibe_remote_home(request, tmp_path, monkeypatch):
+ if request.node.get_closest_marker("uses_real_paths"):
+ return
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / ".vibe_remote"))
diff --git a/tests/test_v2_paths.py b/tests/test_v2_paths.py
index a1275550e..df6b6d510 100644
--- a/tests/test_v2_paths.py
+++ b/tests/test_v2_paths.py
@@ -1,6 +1,9 @@
+import pytest
+
from config import paths
def test_paths_are_under_home():
root = paths.get_vibe_remote_dir()
assert root.name == ".vibe_remote"