-
Notifications
You must be signed in to change notification settings - Fork 6
chore: Housekeeping + improved test coverage #24
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
base: master
Are you sure you want to change the base?
Conversation
While this will not benifit the normal usecase this reduced pytest from 12 sec to 3 sec
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.
Pull Request Overview
This PR focuses on housekeeping improvements and significantly expands test coverage across multiple modules. It addresses technical debt by refactoring the project to make ROS1 support optional and removing the hard dependency on scipy for rotation calculations.
- Introduced optional ROS1 support with proper import guards and runtime error handling
- Replaced scipy dependency with custom rotation utilities for quaternion and point cloud operations
- Added comprehensive test coverage for timing, tf operations, QoS handling, rotation calculations, and plugin functionality
Reviewed Changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/test_timing.py | New comprehensive test suite for ROS1 time fixing functionality |
| test/test_tf.py | Added test for tf_remove functionality with 'all' option |
| test/test_settings.py | New test for SettingRotation validation |
| test/test_rotation.py | Extensive test suite comparing custom rotation implementation with scipy |
| test/test_qos.py | Complete test coverage for QoS parsing and serialization |
| test/test_plugin.py | Added test for multiple plugin implementations |
| test/test_msg_def.py | Tests for message definition handling and URL validation |
| test/test_main.py | Added version command test |
| test/test_json_to_mcap.py | Fixed regex pattern for error message matching |
| test/test_camera_info.py | Test for error handling when header attribute is missing |
| test/e2e/convert/transforms/* | End-to-end test files for tf_remove_all functionality |
| test/e2e/convert/transforms/tf_offset_combined.expected.jsonl | Updated expected values for quaternion precision |
| test/e2e/convert/pointcloud/rotate_quaternion.expected.jsonl | Updated expected rotation results |
| src/kappe/writer.py | Added optional ROS1 support with import guards |
| src/kappe/utils/settings.py | Replaced scipy dependency with custom euler_to_quaternion |
| src/kappe/utils/rotation.py | New module with custom rotation utilities |
| src/kappe/utils/msg_def.py | Performance improvements with LRU cache and tuple optimization |
| src/kappe/utils/mcap_to_json.py | Moved import to top level |
| src/kappe/utils/json_to_mcap.py | Moved import to top level |
| src/kappe/plugins/image.py | Removed unused SaveCompress class and imports |
| src/kappe/plugin.py | Simplified plugin loading logic |
| src/kappe/module/timing.py | Added optional ROS1 support and fixed recursion bug |
| src/kappe/module/tf.py | Replaced scipy with custom quaternion multiplication |
| src/kappe/module/pointcloud.py | Replaced scipy with custom rotation utilities |
| pyproject.toml | Restructured dependencies to make ROS1 optional |
| .pre-commit-config.yaml | Updated tool versions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
siliconlad
left a comment
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.
Small things, otherwise looks good!
|
|
||
|
|
||
| class SaveCompress(ConverterPlugin): | ||
| def __init__(self, *, quality: int = 10) -> None: | ||
| self.quality = quality | ||
| self.counter = 0 | ||
|
|
||
| def convert(self, ros_msg: Any) -> Any: | ||
| stream = BytesIO(ros_msg.data) | ||
| img = Image.open(stream) | ||
| with Path(f'{self.counter:08}.jpeg').open('wb') as f: | ||
| img.save(f, format='jpeg', quality=self.quality) |
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.
Why remove?
| assert 'string data' in result | ||
|
|
||
|
|
||
| def test_get_message_definition_with_custom_folder(tmp_path: Path): |
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.
Custom + std_msgs could be another test.
i.e.
msg_file.write_text('std_msgs/Header header\nstring name\n')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.
What's this change?
| yaml_str = """ | ||
| - history: 1 | ||
| depth: 10 | ||
| reliability: 2 | ||
| durability: 2 | ||
| """ |
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.
My favourite method from textwrap.
| yaml_str = """ | |
| - history: 1 | |
| depth: 10 | |
| reliability: 2 | |
| durability: 2 | |
| """ | |
| yaml_str = dedent(""" | |
| - history: 1 | |
| depth: 10 | |
| reliability: 2 | |
| durability: 2 | |
| """) |
No description provided.