"""Test-suite-wide safety rails. The production translation memory is the product of multi-day, quota-limited runs and cannot be regenerated cheaply. A test that constructs `TranslationMemoryManager()` with no path would read *and write* it — that has already happened once, leaking fixture segments into the real store. The autouse fixture below redirects the default path for every test, so the production store is unreachable from the suite no matter what a test does. """ from __future__ import annotations from pathlib import Path import pytest import src.context.translation_memory as tm_module @pytest.fixture(autouse=True) def _never_touch_the_production_memory(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: """Point the default memory path at a per-test temp directory. Args: tmp_path: Pytest's per-test temp directory. monkeypatch: Pytest's patching fixture. """ monkeypatch.setattr( tm_module, "DEFAULT_STORAGE_PATH", tmp_path / "memory" / "segments.json" )