Skip to content

Add comprehensive model-free unit coverage across animl-lite core modules - #16

Merged
tkswanson merged 5 commits into
devfrom
copilot/build-unit-test-suite-for-animl-lite
Aug 19, 2026
Merged

Add comprehensive model-free unit coverage across animl-lite core modules#16
tkswanson merged 5 commits into
devfrom
copilot/build-unit-test-suite-for-animl-lite

Conversation

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown

This PR adds a broad, fast unit test suite for animl-lite focused on core business logic and utility behavior, while avoiding external model/GPU dependencies. It introduces dedicated coverage for utilities, file management/data structures, export formats, ReID distance metrics, and pipeline orchestration via mocks.

  • Test harness + dependency isolation

    • Added tests/conftest.py with reusable fixtures and import-time stubs for optional heavy dependencies (onnxruntime, exiftool).
    • Added shared manifest/image fixtures to standardize test setup and keep tests deterministic.
  • Utilities + constants (tests/test_utils.py)

    • Covered version reporting, softmax properties, model/type constants, ONNX device/provider selection logic, EXIF/ONNX capability checks, and bbox helper transforms.
  • File management + data structures (tests/test_file_management.py)

    • Covered manifest discovery/filtering, recursive/non-recursive behavior, station/camera depth handling, file IO helpers (csv/json/yaml), prompt-driven file checks, WorkingDirectory, active_times, sequence_calculation, ManifestGenerator, and manifest_dataloader.
  • Export formats (tests/test_export.py)

    • Added coverage for folder export/update/remove flows and output structure validation for COCO, TimeLapse, and MegaDetector exports (including required-column and edge-case behavior).
  • ReID distance metrics (tests/test_reid_distance.py)

    • Added numerical and validation tests for remove_diagonal, euclidean/cosine distance functions, metric dispatch, and batched/non-batched distance parity.
  • Pipeline orchestration (tests/test_pipeline.py)

    • Added from_paths/from_config branch coverage with mocked detector/classifier/video/export/visualization dependencies, including detect-only, sequence/single classification, cached detections, and custom detector class-map paths.
  • Repo hygiene for test delivery

    • Updated .gitignore to stop ignoring tests/, so the new suite is tracked in source control.
# Example: model-free pipeline orchestration test pattern
monkeypatch.setattr(pipeline.detection, "load_detector", lambda *_a, **_k: object())
monkeypatch.setattr(pipeline.classification, "classify", lambda *_a, **_k: np.array([[0.8]]))
out = pipeline.from_paths("/tmp/images", "det.onnx", "cls.onnx", detect_only=True)
assert len(out) == 1

Co-authored-by: tkswanson <4371698+tkswanson@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit test suite for animl-lite modules and utilities Add comprehensive model-free unit coverage across animl-lite core modules Aug 19, 2026
Copilot AI requested a review from tkswanson August 19, 2026 20:11
@tkswanson
tkswanson marked this pull request as ready for review August 19, 2026 20:22
@tkswanson
tkswanson changed the base branch from main to dev August 19, 2026 20:23
@tkswanson
tkswanson merged commit c43e65e into dev Aug 19, 2026
0 of 2 checks passed
@tkswanson
tkswanson deleted the copilot/build-unit-test-suite-for-animl-lite branch August 19, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants