From bee1c0d746dfbcdbc2846457f0026d28da5a277b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:11:32 +0000 Subject: [PATCH 1/4] chore: bump django from 5.0.8 to 5.1 Bumps [django](https://github.com/django/django) from 5.0.8 to 5.1. - [Commits](https://github.com/django/django/compare/5.0.8...5.1) --- updated-dependencies: - dependency-name: django dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e8b1169e..f0913814 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", ] dependencies = [ - "Django==5.0.8", + "Django==5.1", "django-agnocomplete==2.2.0", "django-environ==0.11.2", "django-probes==1.7.0", From 5c31014086663852fcf2ff975eb78ed22ddfccce Mon Sep 17 00:00:00 2001 From: David Larlet Date: Fri, 30 Aug 2024 12:32:10 -0400 Subject: [PATCH 2/4] tests: check collectstatic generates files with hash --- umap/tests/integration/test_statics.py | 47 -------------------------- umap/tests/test_statics.py | 40 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 47 deletions(-) delete mode 100644 umap/tests/integration/test_statics.py create mode 100644 umap/tests/test_statics.py diff --git a/umap/tests/integration/test_statics.py b/umap/tests/integration/test_statics.py deleted file mode 100644 index 4df25705..00000000 --- a/umap/tests/integration/test_statics.py +++ /dev/null @@ -1,47 +0,0 @@ -import re -import shutil -import tempfile -from copy import deepcopy - -import pytest -from django.core.management import call_command -from django.utils.translation import override -from playwright.sync_api import expect - - -@pytest.fixture -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 - finally: - shutil.rmtree(static_root) - - -def test_javascript_have_been_loaded( - map, live_server, datalayer, page, settings, staticfiles -): - datalayer.settings["displayOnLoad"] = False - datalayer.save() - map.settings["properties"]["defaultView"] = "latest" - map.save() - with override("fr"): - url = f"{live_server.url}{map.get_absolute_url()}" - assert "/fr/" in url - page.goto(url) - # Hash is defined, so map is initialized - expect(page).to_have_url(re.compile(r".*#7/48\..+/13\..+")) - expect(page).to_have_url(re.compile(r".*/fr/")) - # Should be in French, so hashed locale file has been loaded correctly - button = page.get_by_role("button", name="Explorateur") - expect(button).to_be_visible() - button.click() - layers = page.locator(".umap-browser .datalayer") - expect(layers).to_have_count(1) diff --git a/umap/tests/test_statics.py b/umap/tests/test_statics.py new file mode 100644 index 00000000..c29b57d7 --- /dev/null +++ b/umap/tests/test_statics.py @@ -0,0 +1,40 @@ +import json +import shutil +import tempfile +from copy import deepcopy +from pathlib import Path + +import pytest +from django.core.management import call_command + + +@pytest.fixture +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 + finally: + shutil.rmtree(static_root) + + +def test_collectstatic_ran_successfully_with_hashes(settings, staticfiles): + static_root = settings.STATIC_ROOT + manifest = Path(static_root) / "staticfiles.json" + assert manifest.exists() + json_manifest = json.loads(manifest.read_text()) + assert "hash" in json_manifest.keys() + assert "umap/base.css" in json_manifest["paths"] + # Hash + the dot ("umap/base..css"). + md5_hash_lenght = 12 + 1 + # The value of the manifest must contain the hash (length). + assert ( + len(json_manifest["paths"]["umap/base.css"]) + == len("umap/base.css") + md5_hash_lenght + ) From 5ca26335d43d8c462907825fc86c3970e3fde8c2 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Fri, 30 Aug 2024 13:04:43 -0400 Subject: [PATCH 3/4] exp: try to increase the number of process passes --- umap/storage.py | 1 + 1 file changed, 1 insertion(+) diff --git a/umap/storage.py b/umap/storage.py index 1ca63a86..94295661 100644 --- a/umap/storage.py +++ b/umap/storage.py @@ -8,6 +8,7 @@ from rjsmin import jsmin class UmapManifestStaticFilesStorage(ManifestStaticFilesStorage): support_js_module_import_aggregation = True + max_post_process_passes = 15 # We remove `;` at the end of all regexps to match our biome config. _js_module_import_aggregation_patterns = ( From 8f735699b22f74d5993ef9781f4aeb10aa281100 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Fri, 30 Aug 2024 13:09:36 -0400 Subject: [PATCH 4/4] exp: bump posgresql to version 14 --- .github/workflows/test-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index 9a564c70..7e14560f 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest services: postgres: - image: postgis/postgis:13-3.4 + image: postgis/postgis:14-3.4 ports: - 5432:5432 env: