限定 Autocal 首版为 finger 并验证视频采集路径

明确视频与相机共用采集接口、事件和时间基准;补充针对性回归测试。
This commit is contained in:
ykcheungab
2026-10-11 11:47:07 +08:00
parent 6923cbf40c
commit 0e34cbfcdb
3 changed files with 94 additions and 12 deletions
@@ -250,6 +250,37 @@ def _config(kind: str) -> Path:
return FINGER_CONFIG if kind == "finger" else BOX_CONFIG
@pytest.mark.parametrize("source", ["recording.mp4", 0])
def test_finger_video_and_camera_use_the_same_packet_path(source, monkeypatch):
"""Both source forms reach FingerRuntime and publish the same packet contract."""
opened: list[str | int] = []
def open_runtime(cls, **kwargs):
opened.append(kwargs["video"])
return cls()
saved = _install()
monkeypatch.setattr(_Runtime, "open", classmethod(open_runtime))
worker = _worker("finger")
packets: list = []
try:
worker.add_sink(packets.append)
worker.start(source, config_ref=FINGER_CONFIG)
deadline = time.perf_counter() + 5.0
while time.perf_counter() < deadline and not packets:
time.sleep(0.02)
assert opened == [source]
assert packets
packet = packets[0]
assert packet.raw_frame.shape == (8, 8, 3)
assert packet.processed_frame.shape == (8, 8, 3)
assert packet.session_id == 1
assert packet.frame_id == 0
finally:
worker.stop(wait=True)
_restore(saved)
@pytest.mark.parametrize("kind", ["box", "finger"])
def test_a_stopped_session_leaves_no_pipeline_threads(kind):
"""``stop`` must join the three stages: they own the sensor's tracker state."""