from __future__ import annotations import importlib.util import json import struct from pathlib import Path def _load_export_module(): candidates = [ Path(__file__).resolve().parents[2] / "render-worker" / "scripts" / "export_step_to_gltf.py", Path("/compose/render-worker/scripts/export_step_to_gltf.py"), ] module_path = next((path for path in candidates if path.exists()), None) assert module_path is not None spec = importlib.util.spec_from_file_location("test_export_step_to_gltf", module_path) assert spec is not None assert spec.loader is not None module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) return module def _write_minimal_glb(path: Path, payload: dict) -> None: json_bytes = json.dumps(payload, separators=(",", ":")).encode() pad = (4 - len(json_bytes) % 4) % 4 json_bytes += b" " * pad chunk = struct.pack(" dict: data = path.read_bytes() json_len = struct.unpack_from("