Files
crochet/conftest.py
T
pablo 734309e955
CI / test (push) Successful in 32s
CI / build (push) Successful in 1m11s
feat: project config
2026-07-17 08:34:44 +02:00

21 lines
881 B
Python

import tempfile
import pytest
from django.core.management import call_command
from django.test import override_settings
@pytest.fixture(scope='session', autouse=True)
def collected_static_files():
"""{% static %} (usado en pattern.html/pattern_detail.html) necesita el
manifest que genera collectstatic cuando STORAGES['staticfiles'] es
CompressedManifestStaticFilesStorage (ver base.py); sin esto,
cualquier test que renderice una de esas plantillas falla con
"Missing staticfiles manifest entry". Se recopila a un directorio
temporal (no al STATIC_ROOT real del proyecto) para no depender de ―ni
tocar― lo que ya haya en config/static/."""
with tempfile.TemporaryDirectory() as static_root:
with override_settings(STATIC_ROOT=static_root):
call_command('collectstatic', interactive=False, verbosity=0)
yield