"""Shared pytest fixtures. The validation engine defaults to a process-global Redis/in-memory cache so results are reused across runs. That is correct in production but leaks state between tests — one test's cached DNS/MX then satisfies the next test's "resolution happened" assertion. Clearing the in-memory tier between tests keeps the suite hermetic without every test having to inject its own cache. Tests that assert on caching still inject a recording cache explicitly. """ import pytest @pytest.fixture(autouse=True) def _clear_global_cache(): try: from app.utils import cache as cache_mod except Exception: # pragma: no cover - import guard yield return cache_mod._memory_cache.clear() yield cache_mod._memory_cache.clear()