"""Fixtures every test gets. The one that matters is the cache: a lookup writes to ``~/.cache`` by default, and a test run that touches the real one leaves entries behind and reads back entries an earlier version wrote. Redirecting it per test makes each run start from nothing. """ import pytest @pytest.fixture(autouse=True) def isolated_cache(tmp_path_factory, monkeypatch): monkeypatch.setenv("XDG_CACHE_HOME", str(tmp_path_factory.mktemp("cache")))