Bug fix: Open3D mock leak between test_yolo.py and test_lidar.py causes 2 test failures#572
Open
Vo1denz wants to merge 2 commits into
Open
Bug fix: Open3D mock leak between test_yolo.py and test_lidar.py causes 2 test failures#572Vo1denz wants to merge 2 commits into
Vo1denz wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #571
Problem
Two tests failed when running the full suite:
Root cause
test_yolo.py stubs open3d with MagicMock at module level (during pytest
collection) to avoid importing the heavy C-extension. The stub persists
in sys.modules, so when perceptionmetrics.utils.lidar imports open3d it
gets the MagicMock. build_point_cloud then returns a MagicMock object
instead of a real PointCloud.
Fix
Three changes:
is collected. The if _stub not in sys.modules guard in test_yolo.py
then skips stubbing it.
with type(obj).name == "PointCloud" as a secondary fix for
Open3D 0.19.0 pybind11 compatibility.
Testing
Full suite: 46 passed, 0 failed (previously 44 passed, 2 failed).