fix(vision): CI has no numpy — the vehicle-stage tests need it without the alpr extra
Build & push images / images (push) Successful in 4m7s
Build & push images / images (push) Successful in 4m7s
CI syncs the service with `uv sync --frozen` (no extra), so test_vehicle.py's module-level numpy import broke collection in ci.yml and both build-images runs. numpy joins the dev group (the service imports it lazily); the one test that resizes with OpenCV skips when cv2 is absent. Reproduced locally in a CI-identical env: 13 passed, 1 skipped; ruff + mypy clean. Claude-Session: https://claude.ai/code/session_01FWncR69HgGPuei1dLrW3cU
This commit is contained in:
@@ -6,6 +6,7 @@ from __future__ import annotations
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from vision_service.schemas import BBox, VehicleResult
|
||||
@@ -82,6 +83,7 @@ def test_pick_prefers_the_box_holding_the_plate_else_the_largest() -> None:
|
||||
|
||||
|
||||
def test_letterbox_keeps_aspect_and_pads_with_114() -> None:
|
||||
pytest.importorskip("cv2") # letterbox resizes with OpenCV — only present with the alpr extra
|
||||
frame = np.zeros((30, 60, 3), dtype=np.uint8)
|
||||
tensor, scale = letterbox(frame, 64)
|
||||
assert tensor.shape == (1, 3, 64, 64) and tensor.dtype == np.float32
|
||||
|
||||
Reference in New Issue
Block a user