import pytest from app import create_app from app.extensions import cache, limiter @pytest.fixture def app(): application = create_app() application.config["TESTING"] = True # Keep cached images and rate-limit counters isolated between tests. with application.app_context(): cache.clear() limiter.reset() yield application with application.app_context(): cache.clear() limiter.reset() @pytest.fixture def client(app): return app.test_client()