"""Project-wide pytest fixtures. The default test environment runs without a collected staticfiles manifest (``addopts = "--reuse-db --nomigrations"`` in pyproject.toml), so any view that renders a template containing ``{% static %}`` tags against ``CompressedManifestStaticFilesStorage`` raises ``ValueError: Missing staticfiles manifest entry for ...``. This autouse fixture swaps in plain ``StaticFilesStorage`` for the duration of every test, so tests can assert ``status_code == 200`` on template-rendering views without first running ``collectstatic``. """ import pytest from django.test import override_settings from config.settings.base import STORAGES as BASE_STORAGES @pytest.fixture(autouse=True) def _disable_static_manifest(): """Use plain StaticFilesStorage (no manifest hashing) during tests.""" staticfiles_storage = { "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", } storages_override = {**BASE_STORAGES, "staticfiles": staticfiles_storage} with override_settings( STATICFILES_STORAGE="django.contrib.staticfiles.storage.StaticFilesStorage", STORAGES=storages_override, ): yield