[AZ-171] Add CoreML inference test

Made-with: Cursor
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-03-28 17:36:18 +02:00
parent 593ab7bce7
commit 4be6c26de2
+16
View File
@@ -104,3 +104,19 @@ class TestCoremlExport:
assert len(pkgs) >= 1
model_file = pkgs[0] / "Data" / "com.apple.CoreML" / "model.mlmodel"
assert model_file.exists()
def test_coreml_inference_produces_detections(self, exported_models):
# Arrange
pkgs = list(exported_models["model_dir"].glob("*.mlpackage"))
assert len(pkgs) >= 1
imgs = sorted(_DATASET_IMAGES.glob("*.jpg"))
if not imgs:
pytest.skip("no test images")
model = YOLO(str(pkgs[0]))
# Act
results = model.predict(source=str(imgs[0]), imgsz=c.config.export.onnx_imgsz, verbose=False)
# Assert
assert len(results) == 1
assert results[0].boxes is not None