-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move test utils #52
base: develop
Are you sure you want to change the base?
Move test utils #52
Conversation
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent updates enhance the validation and testing framework within the codebase. Key improvements include stricter geometric checks for rectangle annotations, the removal of redundant dataset comparison functions, and a restructured import system for test utilities. Additionally, new dataset comparison functionalities have been introduced, particularly for handling 3D datasets. These changes aim to improve code maintainability and clarity, ensuring robust testing processes while simplifying the overall structure. Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (43)
- datumaro/plugins/yolo_format/extractor.py (1 hunks)
- datumaro/util/test_utils.py (2 hunks)
- tests/cli/test_describe_downloads.py (1 hunks)
- tests/cli/test_detect_format.py (1 hunks)
- tests/cli/test_diff.py (1 hunks)
- tests/cli/test_download.py (1 hunks)
- tests/cli/test_filter.py (1 hunks)
- tests/cli/test_generator.py (1 hunks)
- tests/cli/test_image_zip_format.py (1 hunks)
- tests/cli/test_info.py (1 hunks)
- tests/cli/test_kitti_raw_format.py (1 hunks)
- tests/cli/test_merge.py (1 hunks)
- tests/cli/test_patch.py (1 hunks)
- tests/cli/test_project.py (1 hunks)
- tests/cli/test_sly_point_cloud_format.py (1 hunks)
- tests/cli/test_transform.py (1 hunks)
- tests/cli/test_utils.py (1 hunks)
- tests/cli/test_video.py (1 hunks)
- tests/cli/test_voc_format.py (1 hunks)
- tests/cli/test_yolo_format.py (7 hunks)
- tests/conftest.py (1 hunks)
- tests/test_camvid_format.py (1 hunks)
- tests/test_cityscapes_format.py (1 hunks)
- tests/test_coco_format.py (1 hunks)
- tests/test_cvat_format.py (1 hunks)
- tests/test_dataset.py (1 hunks)
- tests/test_datumaro_format.py (1 hunks)
- tests/test_extractor_tfds.py (1 hunks)
- tests/test_icdar_format.py (1 hunks)
- tests/test_image_dir_format.py (1 hunks)
- tests/test_imagenet_format.py (1 hunks)
- tests/test_kitti_format.py (1 hunks)
- tests/test_kitti_raw_format.py (1 hunks)
- tests/test_labelme_format.py (1 hunks)
- tests/test_mot_format.py (1 hunks)
- tests/test_mots_format.py (1 hunks)
- tests/test_project.py (1 hunks)
- tests/test_sampler.py (1 hunks)
- tests/test_sly_pointcloud_format.py (1 hunks)
- tests/test_tfrecord_format.py (1 hunks)
- tests/test_voc_format.py (1 hunks)
- tests/unit/data_formats/test_yolo_format.py (2 hunks)
- tests/utils/test_utils.py (1 hunks)
Files skipped from review due to trivial changes (36)
- tests/cli/test_describe_downloads.py
- tests/cli/test_detect_format.py
- tests/cli/test_diff.py
- tests/cli/test_download.py
- tests/cli/test_filter.py
- tests/cli/test_generator.py
- tests/cli/test_image_zip_format.py
- tests/cli/test_info.py
- tests/cli/test_kitti_raw_format.py
- tests/cli/test_merge.py
- tests/cli/test_patch.py
- tests/cli/test_project.py
- tests/cli/test_sly_point_cloud_format.py
- tests/cli/test_transform.py
- tests/cli/test_utils.py
- tests/cli/test_video.py
- tests/cli/test_voc_format.py
- tests/conftest.py
- tests/test_camvid_format.py
- tests/test_cityscapes_format.py
- tests/test_coco_format.py
- tests/test_cvat_format.py
- tests/test_datumaro_format.py
- tests/test_extractor_tfds.py
- tests/test_icdar_format.py
- tests/test_image_dir_format.py
- tests/test_imagenet_format.py
- tests/test_kitti_format.py
- tests/test_kitti_raw_format.py
- tests/test_labelme_format.py
- tests/test_mots_format.py
- tests/test_project.py
- tests/test_sampler.py
- tests/test_sly_pointcloud_format.py
- tests/test_tfrecord_format.py
- tests/test_voc_format.py
Additional comments not posted (22)
datumaro/util/test_utils.py (5)
11-11
: LGTM! Imports streamlined.The removal of unused imports enhances code clarity and reduces potential confusion.
14-15
: LGTM! Function implementation is correct.The function correctly retrieves the name of the current function.
Line range hint
18-33
:
LGTM! Class implementation is correct.The class correctly implements a context manager for removing files or directories.
Line range hint
36-72
:
LGTM! Class implementation is correct.The class correctly implements a context manager for creating a temporary directory for a test.
Line range hint
75-91
:
LGTM! Function implementation is correct.The function correctly compares the categories of two datasets.
tests/cli/test_yolo_format.py (3)
15-16
: LGTM! Imports updated correctly.The inclusion of
run_datum
fromtests/utils/test_utils
is appropriate.
19-20
: LGTM! Class attributes added correctly.The addition of
ASSET_PATH
andFORMAT_NAME
improves the flexibility and maintainability of the tests.
224-226
: LGTM! New class implemented correctly.The new class
YOLOv8IntegrationScenarios
is correctly implemented and improves code reuse.tests/utils/test_utils.py (8)
4-16
: LGTM! Imports updated correctly.The inclusion of necessary modules and removal of unused ones is appropriate.
27-29
: LGTM! New class implemented correctly.The class
Dimensions
is correctly implemented to categorize datasets as either 2D or 3D.
32-47
: LGTM! Function implemented correctly.The function
compare_datasets_strict
is correctly implemented to compare datasets for strong equality.
49-93
: LGTM! Function implemented correctly.The function
compare_datasets_3d
is correctly implemented to compare 3D datasets, allowing for optional parameters to ignore specific attributes.
96-121
: LGTM! Function updated correctly.The function
check_save_and_load
is correctly updated to incorporate the new comparison logic.
124-141
: LGTM! Function implemented correctly.The function
compare_dirs
is correctly implemented to facilitate the comparison of directory structures and file contents.
144-152
: LGTM! Function updated correctly.The function
run_datum
is correctly adjusted to accommodate the new testing framework.
155-192
: LGTM! Function implemented correctly.The function
mock_tfds_data
is correctly implemented to mock TensorFlow datasets for testing purposes.tests/test_mot_format.py (2)
17-17
: Import statement updated correctly.The import statement has been updated to reflect the new location of
check_save_and_load
, aligning with the PR objective.
15-18
: Function usage updated correctly.The function
_test_save_and_load
now usescheck_save_and_load
from the new location, aligning with the updated import statement.datumaro/plugins/yolo_format/extractor.py (1)
441-444
: Enhanced rectangle validation logic.The additional validation step to check if adjacent sides are orthogonal ensures the robustness of the rectangle validation.
tests/unit/data_formats/test_yolo_format.py (2)
68-68
: Import statement updated correctly.The import statement has been updated to reflect the new location of
compare_datasets_strict
, aligning with the PR objective.
1165-1175
: New test function added correctly.The new test function
test_can_report_invalid_shape_parallelogram
ensures that the system correctly identifies and reports errors for invalid shapes, specifically parallelograms.tests/test_dataset.py (1)
59-60
: Verify the new import path forcompare_datasets_strict
.Ensure that
compare_datasets_strict
is correctly located intests/utils/test_utils.py
and that it is used correctly in the test cases.Verification successful
The import path for
compare_datasets_strict
is correct and it is used appropriately intests/test_dataset.py
.
- The function
compare_datasets_strict
is defined intests/utils/test_utils.py
.- The function is imported and used correctly in
tests/test_dataset.py
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the new import path for `compare_datasets_strict`. # Test: Check if the function exists in the new path. rg --type python --files-with-matches --glob 'tests/utils/test_utils.py' 'def compare_datasets_strict'Length of output: 133
Script:
#!/bin/bash # Description: Verify the new import path for `compare_datasets_strict`. # Test: Check if the function exists in the new path. rg 'def compare_datasets_strict' -g 'tests/utils/test_utils.py'Length of output: 162
Script:
#!/bin/bash # Description: Verify the usage of `compare_datasets_strict` in `tests/test_dataset.py`. # Test: Check where the function is used in the test file. rg 'compare_datasets_strict' -g 'tests/test_dataset.py'Length of output: 210
with pytest.raises(AnnotationImportError) as capture: | ||
Dataset.import_from(test_dir, self.IMPORTER.NAME).init_cache() | ||
assert isinstance(capture.value.__cause__, InvalidAnnotationError) | ||
assert "adjacent sides are not orthogonal" in str(capture.value.__cause__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider checking this by the match
parameter in raises()
.
e2d40f0
to
3a566c4
Compare
Quality Gate passedIssues Measures |
Summary
moving most of test_utils.py from datumaro/util to tests/utils (as in upstream)
depends on cvat-ai/cvat#8259
How to test
Checklist
develop
branchLicense
Feel free to contact the maintainers if that's a concern.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Documentation