Coverage: - test_model: SimpleNet forward (parametrized over batch sizes and both unsqueezed and flat input shapes), layer dimensions, differentiability, and ONNX round-trip - test_inference: load_model resolution order (bundled, cwd override, explicit path, missing path), and predict shape/dtype/determinism plus endpoint sanity across 8 cardinal/diagonal targets - test_train: _load_csv parsing, TrajectoryDataset indexing, full train() pipeline producing a single-file ONNX, plus a smoke test against the real data shipped under data/ - test_cli: --help for the three console scripts and a real run of mouse-visualize via both the entry point and python -m Wire up pytest via dependency-groups and tool.pytest.ini_options.
33 lines
748 B
Python
33 lines
748 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parent.parent
|
|
DATA_DIR = REPO_ROOT / "data"
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def train_csv() -> Path:
|
|
path = DATA_DIR / "mouse_data.csv"
|
|
if not path.is_file():
|
|
pytest.skip(f"missing training csv: {path}")
|
|
return path
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def test_csv() -> Path:
|
|
path = DATA_DIR / "mouse_data_test.csv"
|
|
if not path.is_file():
|
|
pytest.skip(f"missing test csv: {path}")
|
|
return path
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def bundled_session():
|
|
"""Shared inference session for the bundled model (loading is slow)."""
|
|
from mouse_control import load_model
|
|
|
|
return load_model()
|