Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627"""Filesystem layout.
RUNTIME_DIR and DATA_DIR are read once, at import time (see paths.py's moduledocstring), so pinning a property of how they're derived means reloading themodule under a patched environment rather than reading the live attributes."""
from __future__ import annotations
import importlib
from code_index import paths
def test_runtime_dir_does_not_follow_data_dir(monkeypatch): """The embedding server's pid file belongs to the server, not to whichever worktree's index CODE_INDEX_DATA happens to point at.""" monkeypatch.setenv("CODE_INDEX_DATA", "/tmp/some-worktree/.index") monkeypatch.delenv("CODE_INDEX_RUNTIME", raising=False) importlib.reload(paths) try: assert paths.DATA_DIR == "/tmp/some-worktree/.index" assert "some-worktree" not in paths.RUNTIME_DIR finally: monkeypatch.undo() importlib.reload(paths)