Sortir l'interface de la carte en vrais fichiers web/map.{html,css,js}

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Antoine Jacquin
2026-09-27 17:26:41 +02:00
parent 4bc9c1852b
commit 75a562d6a4
6 changed files with 1649 additions and 1606 deletions

View File

@ -0,0 +1,37 @@
"""Chargeur de l'interface : fichiers web/ du paquet, versions, syntaxe JS."""
import shutil
import subprocess
import pytest
def test_constants_are_read_from_web_files():
from lidar_pipeline import mapui
for name, text in (("map.html", mapui._MAP_HTML), ("map.css", mapui._MAP_CSS),
("map.js", mapui._MAP_JS)):
assert (mapui.WEB_DIR / name).read_text(encoding="utf-8") == text
def test_web_files_ship_with_installed_package():
# Image complète : paquet installé par pip (package_data) — les trois
# fichiers doivent y être, sinon l'interface est vide en production.
import lidar_pipeline
from pathlib import Path
web = Path(lidar_pipeline.__file__).resolve().parent / "web"
for name in ("map.html", "map.css", "map.js"):
assert (web / name).is_file(), name
def test_markers_kept():
from lidar_pipeline import mapui
assert "__ASSETS_V__" in mapui._MAP_HTML
assert "__UI_VERSION__" in mapui._MAP_JS
assert "__ASSETS_V__" not in mapui.render_html()
@pytest.mark.skipif(shutil.which("node") is None, reason="node absent")
def test_js_syntax():
from lidar_pipeline import mapui
res = subprocess.run(["node", "--check", str(mapui.WEB_DIR / "map.js")],
capture_output=True, text=True)
assert res.returncode == 0, res.stderr