Download tests/conftest.py from sitcod3/modul-x: direct link, hf CLI and curl.
- Browser
- Download file 783 Bytes
-
https://huggingface.co/spaces/sitcod3/modul-x/resolve/main/tests/conftest.py
- Command line
-
hf download hf://spaces/sitcod3/modul-x/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/spaces/sitcod3/modul-x/resolve/main/tests/conftest.py
783 Bytes
| """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 | |
| 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() |