Prüfe die Beispielquelle ohne Node, weil die Pytest-Umgebung im Backend-Image kein Node enthält.
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Successful in 2m37s
Test Suite / smoke-dev (push) Successful in 1s
Test Suite / frontend-build (push) Successful in 20s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-20 07:45:21 +02:00
1 parent 7e39fbb2bd
commit 34c4084a7c
1 file changed
+22 -21
+22 -21
View File
@@ -3,7 +3,6 @@
from __future__ import annotations
import io
import subprocess
import zipfile
from pathlib import Path
@@ -171,26 +170,28 @@ def test_sample_registration_does_not_edit_generic_modules():
for relative in forbidden:
text = (ROOT / relative).read_text(encoding="utf-8")
assert '"sample"' not in text and "'sample'" not in text, relative
completed = subprocess.run(
[
"node",
"--input-type=module",
"-e",
(
"import { installSampleSource, removeSampleSource } from './src/sources/sample-source.js';"
"import { sourceModules } from './src/sources/registry-core.js';"
"installSampleSource();"
"if (!sourceModules().some((item) => item.kind === 'sample' && item.representation === 'text')) process.exit(2);"
"removeSampleSource();"
"if (sourceModules().some((item) => item.kind === 'sample')) process.exit(3);"
),
],
cwd=ROOT / "frontend",
check=False,
capture_output=True,
text=True,
)
assert completed.returncode == 0, completed.stderr
# The backend image that runs this suite has no Node. The sample module is
# small enough to check against the registry operations it calls.
sample = (ROOT / "frontend/src/sources/sample-source.js").read_text(encoding="utf-8")
registry = (ROOT / "frontend/src/sources/registry-core.js").read_text(encoding="utf-8")
assert "registerSourceModule" in sample and "unregisterSourceModule" in sample
assert 'kind: "sample"' in sample and 'representation: "text"' in sample
assert 'unregisterSourceModule("sample")' in sample
assert "modules.set(module.kind, module)" in registry
assert "modules.delete(kind)" in registry
modules: dict[str, dict] = {}
def register(module: dict) -> dict:
modules[module["kind"]] = module
return module
def unregister(kind: str) -> None:
modules.pop(kind, None)
register({"kind": "sample", "representation": "text"})
assert any(item["kind"] == "sample" and item["representation"] == "text" for item in modules.values())
unregister("sample")
assert not any(item["kind"] == "sample" for item in modules.values())
def _raw(actor: Actor, path: str):