Merge pull request #1639 from umap-project/fix-statics-test

chore: attempt to fix randomly failing test
This commit is contained in:
Yohan Boniface 2024-02-20 14:23:46 +01:00 committed by GitHub
commit 7d7eb37772
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View file

@ -5,8 +5,6 @@ import pytest
from django.core.cache import cache
from django.core.signing import get_cookie_signer
from umap.models import Map
from .base import (
DataLayerFactory,
LicenceFactory,

View file

@ -1,6 +1,7 @@
import re
import shutil
import tempfile
from copy import deepcopy
import pytest
from django.core.management import call_command
@ -12,6 +13,11 @@ from playwright.sync_api import expect
def staticfiles(settings):
static_root = tempfile.mkdtemp(prefix="test_static")
settings.STATIC_ROOT = static_root
# Make sure settings are properly reset after the test
settings.STORAGES = deepcopy(settings.STORAGES)
settings.STORAGES["staticfiles"][
"BACKEND"
] = "umap.storage.UmapManifestStaticFilesStorage"
try:
call_command("collectstatic", "--noinput")
yield
@ -22,9 +28,6 @@ def staticfiles(settings):
def test_javascript_have_been_loaded(
map, live_server, datalayer, page, settings, staticfiles
):
settings.STORAGES["staticfiles"][
"BACKEND"
] = "umap.storage.UmapManifestStaticFilesStorage"
datalayer.settings["displayOnLoad"] = False
datalayer.save()
map.settings["properties"]["defaultView"] = "latest"