Files
Yuzviak 5744ff65ac feat(02-03): apply module-level pytestmark to 37 test files
- Add pytestmark = [pytest.mark.<category>] to all 23 root test files and 14 e2e test files
- Marker distribution: 22 unit, 7 integration, 1 blackbox, 1 sitl, 5 e2e + 2 e2e integration
- Add import pytest to test_models.py, test_download.py, test_synthetic_adapter.py (were missing)
- Convert test_sitl_integration.py's bare pytestmark to list form preserving skipif guard
- Union of all 5 markers = 298/298 = 100% coverage; 216 tests pass with --strict-markers
2026-05-11 18:20:05 +03:00

55 lines
1.4 KiB
Python

"""Tests for Model Manager (F16)."""
import numpy as np
import pytest
from gps_denied.core.models import ModelManager
pytestmark = [pytest.mark.unit]
def test_load_and_get_model():
manager = ModelManager()
# Should auto-load
engine = manager.get_inference_engine("SuperPoint")
assert engine.model_name == "SuperPoint"
# Check fallback/dummy
assert manager.fallback_to_onnx("SuperPoint") is True
assert manager.optimize_to_tensorrt("SuperPoint", "path.onnx") == "path.onnx.trt"
def test_mock_superpoint():
manager = ModelManager()
engine = manager.get_inference_engine("SuperPoint")
dummy_img = np.zeros((480, 640, 3), dtype=np.uint8)
res = engine.infer(dummy_img)
assert "keypoints" in res
assert "descriptors" in res
assert "scores" in res
assert len(res["keypoints"]) == 500
assert res["descriptors"].shape == (500, 256)
def test_mock_lightglue():
manager = ModelManager()
engine = manager.get_inference_engine("LightGlue")
# Need mock features
class DummyF:
def __init__(self, keypoints):
self.keypoints = keypoints
f1 = DummyF(np.random.rand(120, 2))
f2 = DummyF(np.random.rand(150, 2))
res = engine.infer({"features1": f1, "features2": f2})
assert "matches" in res
assert len(res["matches"]) == 100 # min(100, 120, 150)
assert res["keypoints1"].shape == (100, 2)
assert res["keypoints2"].shape == (100, 2)