"""Fixtures partagées : aucune base de production, aucun accès réseau.""" import importlib import pytest import brands import market import storage @pytest.fixture(autouse=True) def isolated_database(tmp_path, monkeypatch): """Toutes les bases pointent vers un fichier temporaire, jamais /var/lib.""" for module in (storage, brands, market): monkeypatch.setattr(module, "DB_PATH", tmp_path / f"{module.__name__}.sqlite3") # Aucun test ne doit interroger Nominatim ou un fournisseur de cours. monkeypatch.setattr(brands, "fetch_candidates", lambda *args, **kwargs: []) monkeypatch.setattr(market, "PROVIDERS", {}) # Aucun test ne doit sortir sur le réseau pour les sources amont. collector = importlib.import_module("collector") monkeypatch.setattr(collector, "UPSTREAM_SOURCES", {}) return tmp_path @pytest.fixture def store(): return storage