Skip to content

test cases for AbstractObjectDetector#1261

Open
john- wants to merge 2 commits intoroflcoopter:devfrom
john-:test_abstract_object_detector_squashed
Open

test cases for AbstractObjectDetector#1261
john- wants to merge 2 commits intoroflcoopter:devfrom
john-:test_abstract_object_detector_squashed

Conversation

@john-
Copy link
Copy Markdown

@john- john- commented Feb 24, 2026

This PR contains test cases for the AbstractObjectDetector base class. Any and all feedback is welcome.

---------- coverage: platform linux, python 3.10.12-final-0 ----------
Name                                                 Stmts   Miss  Cover   Missing
----------------------------------------------------------------------------------
viseron/domains/object_detector/__init__.py            209      2    99%   532, 539
viseron/domains/object_detector/binary_sensor.py        76     24    68%   34, 46, 51, 55-62, 66-68, 131, 136, 140-150, 154-158
viseron/domains/object_detector/const.py                70      0   100%
viseron/domains/object_detector/detected_object.py     129     16    88%   83-86, 101-112, 127-134, 183, 188, 193, 198, 203, 208, 266, 277, 292
viseron/domains/object_detector/sensor.py               22      4    82%   35, 40, 49, 53
viseron/domains/object_detector/zone.py                 57      3    95%   101, 109, 148
----------------------------------------------------------------------------------
TOTAL                                                  563     49    91%


Results (2.63s):
      72 passed

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 24, 2026

Deploy Preview for viseron ready!

Name Link
🔨 Latest commit df4fba4
🔍 Latest deploy log https://app.netlify.com/projects/viseron/deploys/69ab38984069d300082cad83
😎 Deploy Preview https://deploy-preview-1261--viseron.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@roflcoopter
Copy link
Copy Markdown
Owner

Thank you for this! Gonna take me a little while to read through it

@john-
Copy link
Copy Markdown
Author

john- commented Feb 27, 2026

No problem. I am afraid to say there is a lot to it so understand review may take a while...or not be worth it :)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a comprehensive unit/integration-style test suite for viseron.domains.object_detector.AbstractObjectDetector, improving confidence in filtering, zone handling, storage interactions, and lifecycle behavior while keeping tests isolated from background threads and side effects.

Changes:

  • Introduces tests/domains/object_detector/test_abstract_object_detector.py covering constructor behavior, FoV filters, zones, storage insertion, and _object_detection loop termination.
  • Updates tests/conftest.py MockViseron to mock dispatch_event to prevent side effects and allow assertions in the new tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/domains/object_detector/test_abstract_object_detector.py New test module validating AbstractObjectDetector core behaviors end-to-end with controlled mocks.
tests/conftest.py Extends MockViseron to mock dispatch_event, supporting the new tests without triggering real event dispatch behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


ConcreteObjectDetector(vis, base_config, CAMERA_IDENTIFIER)

# Aleasys called: ObjectDetectedBinarySensorFoV + ObjectDetectorFPSSensor
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: “Aleasys called” is likely intended to be “Always called”. This may also trip codespell in CI.

Suggested change
# Aleasys called: ObjectDetectedBinarySensorFoV + ObjectDetectorFPSSensor
# Always called: ObjectDetectedBinarySensorFoV + ObjectDetectorFPSSensor

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I use the Copilot option to commit the typo correction or create a new pull request or something else?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just fix it yourself locally and push another commit, no need to create a new PR.

I used the "Commit suggestion" once and the AI messed up so i wouldnt trust it, even for that simple change😄

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.

3 participants