Honor YOLO preflight environment config
This commit is contained in:
@@ -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(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user