From eb755c02c6e4f0bb2234ec787558a5b82c43938a Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 20 Feb 2024 13:59:59 +0100 Subject: [PATCH] chore: attempt to fix randomly failing test --- umap/tests/conftest.py | 2 -- umap/tests/integration/test_statics.py | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/umap/tests/conftest.py b/umap/tests/conftest.py index 7e0b034e..78e207cb 100644 --- a/umap/tests/conftest.py +++ b/umap/tests/conftest.py @@ -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, diff --git a/umap/tests/integration/test_statics.py b/umap/tests/integration/test_statics.py index 3f833425..7f2a0679 100644 --- a/umap/tests/integration/test_statics.py +++ b/umap/tests/integration/test_statics.py @@ -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"