Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ jobs:
run: |
for f in formDAM build_app backend/oc_install backend/boot_backend frontend/oc_install frontend/boot_frontend setup/*; do
case "$f" in *.bat|*.py) continue ;; esac
[ -f "$f" ] || continue
bash -n "$f"
done
- name: No em dash or emoji in tracked markdown
Expand Down
5,467 changes: 2,981 additions & 2,486 deletions THIRD-PARTY-NOTICES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backend/tests/test_build_tree_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def tracked(path):

def test_every_icon_generation_writes_outside_the_tracked_icons():
calls = []
for script in sorted((REPO / "setup").iterdir()):
for script in sorted(p for p in (REPO / "setup").iterdir() if p.is_file()):
for line in script.read_text(encoding="utf-8", errors="replace").splitlines():
match = ICON_CALL.search(line)
if match:
Expand Down
44 changes: 43 additions & 1 deletion backend/tests/test_notices.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import importlib.util
import os
import sys

from tests.conftest import HEADERS

SETUP = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "setup")


def load_notices(monkeypatch):
monkeypatch.setattr(sys, "dont_write_bytecode", True)
monkeypatch.syspath_prepend(SETUP)
spec = importlib.util.spec_from_file_location("notices_under_test", os.path.join(SETUP, "notices.py"))
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module


def test_engine_serves_the_bundled_third_party_notices(client):
res = client.get("/api/notices", headers=HEADERS)
assert res.status_code == 200 and res.headers["content-type"].startswith("text/plain")
for line in ("python: pypdf 7.2.0", "npm: lottie-web 5.12.2", "crate: tauri ", "binary: ffmpeg "):
for line in ("runtime: python ", "python: fastapi 0.121.1", "python: pypdf 7.2.0", "npm: lottie-web 5.12.2", "crate: tauri ", "binary: ffmpeg "):
assert line in res.text


Expand All @@ -13,3 +28,30 @@ def test_missing_notices_are_reported_not_invented(client, tmp_path, monkeypatch

monkeypatch.setattr(system, "notices_path", lambda: str(tmp_path / "none.txt"))
assert client.get("/api/notices", headers=HEADERS).status_code == 404


def test_notices_check_passes_for_this_tree(monkeypatch):
assert load_notices(monkeypatch).check() == []


def test_notices_check_names_missing_and_stale_sections(tmp_path, monkeypatch):
notices = load_notices(monkeypatch)
with open(notices.OUT, encoding="utf-8") as handle:
sections = notices.parse(handle.read())
kept = [s for s in sections if (s.kind, s.name) != ("python", "fastapi")]
stale = notices.Section("crate", "not-a-shipped-crate", "0.0.1", "MIT", "https://example.invalid", [])
written = tmp_path / "notices.txt"
written.write_text(notices.render([*kept, stale]), encoding="utf-8")
monkeypatch.setattr(notices, "OUT", str(written))
problems = notices.check()
assert "python fastapi 0.121.1 is pinned but the notices list None" in problems
assert "python fastapi 0.121.1 ships but has no notice" in problems
assert "crate not-a-shipped-crate 0.0.1 has a notice but no longer ships" in problems
assert len(problems) == 3


def test_notices_check_fails_without_the_file(tmp_path, monkeypatch):
notices = load_notices(monkeypatch)
monkeypatch.setattr(notices, "OUT", str(tmp_path / "absent.txt"))
problems = notices.check()
assert len(problems) == 1 and problems[0].endswith("absent.txt is missing")
Loading
Loading