Honor YOLO preflight environment config
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-07-09 02:28:29 +02:00
parent 20c942df50
commit f9493479c7
5 changed files with 45 additions and 6 deletions
@@ -197,6 +197,36 @@ def test_yolo_preflight_script_outputs_json(tmp_path: Path) -> None:
assert payload["tile_manifest_path"] == str(manifest_path)
def test_yolo_preflight_script_uses_environment_configuration(tmp_path: Path, monkeypatch) -> None:
model_path = tmp_path / "model.pt"
model_path.write_bytes(b"weights")
manifest_path = _manifest(tmp_path)
monkeypatch.setenv("YOLO_ENABLED", "true")
monkeypatch.setenv("YOLO_MODEL_PATH", str(model_path))
monkeypatch.setenv("YOLO_MAX_TILES", "4")
result = subprocess.run(
[
sys.executable,
str(ROOT / "scripts" / "yolo_preflight.py"),
"--tile-manifest-path",
str(manifest_path),
"--assume-dependencies",
"--json",
],
cwd=ROOT,
check=True,
capture_output=True,
text=True,
)
payload = json.loads(result.stdout)
assert payload["status"] == "ready"
assert payload["checks"]["enabled"] is True
assert payload["model_path"] == str(model_path)
assert payload["max_tiles"] == 4
def test_yolo_preflight_script_rejects_assumed_dependencies_for_model_load(tmp_path: Path) -> None:
result = subprocess.run(
[