chore: attempt to fix randomly failing test

This commit is contained in:
Yohan Boniface 2024-02-20 13:59:59 +01:00
parent 2fa1d42ee7
commit eb755c02c6
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"