Files
crochet/conftest.py
T
pablo b28293d5b2
CI / test (push) Failing after 20s
CI / build (push) Has been skipped
feat: added tests
2026-07-16 15:08:04 +02:00

21 lines
885 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 settings.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