correct overlapping checkpoint evaluation
GeoIntel release gates / Compile, test, contracts and builds (push) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (push) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (push) Canceled after 0s

This commit is contained in:
Jens
2026-08-09 20:41:54 +02:00
parent 2de438b9cc
commit 48084799c9
11 changed files with 539 additions and 10 deletions
@@ -1,4 +1,5 @@
from pathlib import Path
import shlex
import subprocess
import sys
@@ -8,7 +9,9 @@ ROOT = Path(__file__).resolve().parents[2]
def test_operator_yolo_dataset_export_script_contract() -> None:
script_path = ROOT / "scripts" / "export_operator_yolo_dataset.py"
readiness = (ROOT / "scripts" / "run_readiness_check.sh").read_text(encoding="utf-8")
readiness = (ROOT / "scripts" / "run_readiness_check.sh").read_text(
encoding="utf-8"
)
assert script_path.exists()
script = script_path.read_text(encoding="utf-8")
@@ -42,14 +45,18 @@ def test_operator_yolo_dataset_export_help_does_not_require_gis_dependencies() -
)
assert result.returncode == 0
assert "Export operator real-data samples to a YOLO detection dataset" in result.stdout
assert (
"Export operator real-data samples to a YOLO detection dataset" in result.stdout
)
assert "--manifest-path" in result.stdout
assert "--val-samples" in result.stdout
def test_operator_yolo_train_smoke_script_contract() -> None:
script_path = ROOT / "scripts" / "train_operator_yolo_detector.sh"
readiness = (ROOT / "scripts" / "run_readiness_check.sh").read_text(encoding="utf-8")
readiness = (ROOT / "scripts" / "run_readiness_check.sh").read_text(
encoding="utf-8"
)
assert script_path.exists()
script = script_path.read_text(encoding="utf-8")
@@ -62,7 +69,7 @@ def test_operator_yolo_train_smoke_script_contract() -> None:
assert "TRAIN_EPOCHS" in script
assert "TRAIN_IMGSZ" in script
assert "/opt/geointel/venv/bin/python" in script
assert "PYTHON_BIN=\"python3\"" in script
assert 'PYTHON_BIN="python3"' in script
assert "dataset.yaml" in script
assert "from ultralytics import YOLO" in script
assert "model.train" in script
@@ -76,6 +83,42 @@ def test_operator_yolo_train_smoke_script_contract() -> None:
assert '"base_model_sha256"' in script
assert '"trained_model_sha256"' in script
assert "training_release_manifest.py" in script
assert "NO_TRAINING.json" in script
assert "Training is prohibited for this evaluation-only dataset" in script
assert "verify" in script
assert "download" not in script.lower()
assert "fixture_mode" not in script
def test_operator_yolo_train_rejects_evaluation_only_marker(tmp_path: Path) -> None:
dataset_dir = tmp_path / "evaluation-only"
dataset_dir.mkdir()
(dataset_dir / "dataset.yaml").write_text("val: images/val\n", encoding="utf-8")
(dataset_dir / "NO_TRAINING.json").write_text(
'{"training_prohibited": true}\n', encoding="utf-8"
)
def shell_path(path: Path) -> str:
if path.drive:
return f"/mnt/{path.drive[0].lower()}/{path.as_posix()[3:]}"
return str(path)
dataset_shell_path = shell_path(dataset_dir)
model_shell_path = shell_path(tmp_path / "missing.pt")
script_shell_path = shell_path(ROOT / "scripts" / "train_operator_yolo_detector.sh")
command = (
f"OPERATOR_YOLO_DATASET_DIR={shlex.quote(dataset_shell_path)} "
f"YOLO_BASE_MODEL_PATH={shlex.quote(model_shell_path)} "
f"bash {shlex.quote(script_shell_path)}"
)
result = subprocess.run(
["bash", "-lc", command],
capture_output=True,
text=True,
check=False,
)
assert result.returncode == 1
assert "Training is prohibited for this evaluation-only dataset" in result.stderr
assert "Base model file not found" not in result.stderr