chore: init from code-review-graph-main snapshot (v2.3.7)

This commit is contained in:
dev
2026-08-05 13:16:12 +08:00
commit 82b7c6dc9e
358 changed files with 118525 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
"""Shared test fixtures.
Keeps code-review-graph's own per-user state out of the developer's real
home directory. Scoped deliberately: the editor-integration installers in
``skills.py`` write to other user-level locations (``~/.codex``,
``~/.cursor``, ``~/.config/opencode``) that are outside CRG state and are
not covered here — those tests patch ``Path.home()`` themselves.
"""
from __future__ import annotations
import pytest
@pytest.fixture(autouse=True)
def isolated_crg_home(tmp_path_factory, monkeypatch):
"""Redirect the per-user state directory into a temporary directory.
``~/.code-review-graph`` holds ``registry.json``, ``watch.toml``,
``daemon.pid``, ``daemon-state.json`` and ``logs/``. Two paths reached
the real one:
* ``Registry()`` defaults there, and ``incremental.get_data_dir()``
constructs one internally — so any test touching data-dir resolution
both read and wrote the registry of whoever ran the suite. That put
pytest tmp paths into a developer's home directory, and made those
tests depend on machine state: a developer with a registered repo
could get different results from one without.
* ``daemon`` built its config/PID/state paths from ``Path.home()``.
Autouse and unconditional: an opt-in fixture would silently stop
protecting a test the day someone forgets to request it.
"""
home = tmp_path_factory.mktemp("crg-home")
monkeypatch.setenv("CRG_HOME", str(home))
return home