Skip to content

test: add 31 integration tests for main() detection loop - #25

Merged
johnoct merged 1 commit into
mainfrom
feat/integration-tests
Feb 7, 2026
Merged

test: add 31 integration tests for main() detection loop#25
johnoct merged 1 commit into
mainfrom
feat/integration-tests

Conversation

@johnoct

@johnoct johnoct commented Feb 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds tests/test_integration.py with 31 tests covering the main() detection loop end-to-end
  • Tests 7 critical interaction paths that unit tests miss: motion pipeline, sound pipeline, camera reconnection, health checks, dynamic settings, display/encoding, and cleanup
  • Uses a MainRunner context manager that mocks hardware deps while keeping real FrameBuffer and EventLog

Test plan

  • All 31 integration tests pass (pytest tests/test_integration.py -v)
  • Full suite of 244 tests pass (pytest tests/ -v)
  • No changes to production code

Closes #21

Cover the 7 critical interaction paths that unit tests miss:
- Motion pipeline (detection → notification → event log → snapshot)
- Sound pipeline (audio monitor → notification → cooldown)
- Camera reconnection (dropped frames → reconnect → state reset)
- Health checks (dead audio/web threads → restart/disable)
- Dynamic settings (sensitivity/fps/ROI changes mid-run)
- Display & encoding (JPEG buffer, night mode, quit on 'q')
- Cleanup (KeyboardInterrupt → release camera, stop audio)

Uses a MainRunner context manager that mocks all hardware deps
(camera, display, audio, osascript) while keeping real FrameBuffer
and EventLog. Loop exit controlled via KeyboardInterrupt from
cap.read() after consuming test frames.

Closes #21
@johnoct
johnoct force-pushed the feat/integration-tests branch from f2426a3 to fd7c4ec Compare February 7, 2026 04:07
@johnoct
johnoct merged commit 2bf7469 into main Feb 7, 2026
1 check passed
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.

Add integration tests for main() detection loop

1 participant