Wires together AppConfig.load() (JSON config -> markers/guide_box), calibrate.py (one-time empty-platform reference capture), and run.py (build_strategy dispatch + camera/session/FastAPI wiring via uvicorn) to complete Phase 1 intake station integration.
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
from pathlib import Path
|
|
|
|
import numpy as np
|
|
import pytest
|
|
|
|
from bookmark.capture_strategies.manual_button import ManualButtonStrategy
|
|
from bookmark.capture_strategies.motion_stop import MotionStopStrategy
|
|
from bookmark.capture_strategies.stable_centered import StableCenteredStrategy
|
|
from bookmark.config import AppConfig
|
|
from run import build_strategy
|
|
|
|
|
|
def make_config(trigger_strategy: str) -> AppConfig:
|
|
return AppConfig(
|
|
device_index=0,
|
|
catalogue_path=Path("catalogue.csv"),
|
|
captures_dir=Path("captures"),
|
|
reference_frame_path=Path("reference.jpg"),
|
|
markers=[],
|
|
guide_box=(0, 0, 10, 10),
|
|
trigger_strategy=trigger_strategy,
|
|
)
|
|
|
|
|
|
def test_build_strategy_manual():
|
|
strategy = build_strategy(make_config("manual"), np.zeros((10, 10, 3), dtype=np.uint8))
|
|
assert isinstance(strategy, ManualButtonStrategy)
|
|
|
|
|
|
def test_build_strategy_motion_stop():
|
|
strategy = build_strategy(make_config("motion_stop"), np.zeros((10, 10, 3), dtype=np.uint8))
|
|
assert isinstance(strategy, MotionStopStrategy)
|
|
|
|
|
|
def test_build_strategy_stable_centered():
|
|
strategy = build_strategy(make_config("stable_centered"), np.zeros((10, 10, 3), dtype=np.uint8))
|
|
assert isinstance(strategy, StableCenteredStrategy)
|
|
|
|
|
|
def test_build_strategy_unknown_raises():
|
|
with pytest.raises(ValueError):
|
|
build_strategy(make_config("bogus"), np.zeros((10, 10, 3), dtype=np.uint8))
|