test(integration): lint the Python in ros2_medkit_integration_tests - #598
Open
bburda wants to merge 1 commit into
Open
test(integration): lint the Python in ros2_medkit_integration_tests#598bburda wants to merge 1 commit into
bburda wants to merge 1 commit into
Conversation
The package registered no linter, so its 91 Python files sat outside `colcon test -L linter` and the documented lint command reported success without checking any of them. The pre-commit hooks did check them, which made the gap show up as a push rejected after a clean local lint run. Register flake8 and correct the quote style it reports. The rewrite is mechanical: every touched file parses to an identical AST. ament_pep257 belongs here too and every other package that ships Python runs it, but this package drifted while unchecked and 563 docstrings put the summary on the opening line. That is its own change. Closes #596
Contributor
There was a problem hiding this comment.
Pull request overview
This PR closes the linting gap in ros2_medkit_integration_tests by registering a Python linter test (flake8) so the package is covered by colcon test --ctest-args -L linter, aligning CI lint behavior with the pre-commit hooks.
Changes:
- Register
ament_cmake_flake8+ament_flake8()underif(BUILD_TESTING)for the integration tests package. - Add the required
ament_cmake_flake8test dependency inpackage.xml. - Apply mechanical quote-style adjustments in a small set of Python tests to satisfy the configured flake8 rules.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/ros2_medkit_integration_tests/CMakeLists.txt | Adds ament_cmake_flake8 discovery and registers ament_flake8() in the BUILD_TESTING block. |
| src/ros2_medkit_integration_tests/package.xml | Adds ament_cmake_flake8 as a test dependency so the linter test is available in CI. |
| src/ros2_medkit_integration_tests/test/features/test_logging_api.test.py | Quote-style adjustments in f-strings to satisfy flake8. |
| src/ros2_medkit_integration_tests/test/features/test_discovery_namespace_filter.test.py | Quote-style adjustments in assertion message. |
| src/ros2_medkit_integration_tests/test/features/test_discovery_legacy_mode.test.py | Quote-style adjustments in assertion messages (including multi-part f-string). |
| src/ros2_medkit_integration_tests/test/features/test_discovery_layer_policies.test.py | Quote-style adjustments in assertion messages. |
| src/ros2_medkit_integration_tests/test/features/test_discovery_gap_fill.test.py | Quote-style adjustments in assertion messages. |
| src/ros2_medkit_integration_tests/test/features/test_daisy_chain_aggregation.test.py | Switches f-string triple quotes to avoid quote-rule violations while preserving the literal content. |
| src/ros2_medkit_integration_tests/test/docker/introspection/test_systemd_introspection.py | Quote-style adjustments across decorators, requests, and asserts. |
| src/ros2_medkit_integration_tests/test/docker/introspection/test_container_introspection.py | Quote-style adjustments across decorators, requests, and asserts. |
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.
Pull Request
Summary
ros2_medkit_integration_testshas 91 Python files and registered no linter. Itsif(BUILD_TESTING)block set up the launch tests but never calledament_lint_auto_find_test_dependencies(), and the package had no flake8 test dependency. Every other package in the tree that ships Python registers one.So
./scripts/test.sh lint, andcolcon test --ctest-args -L linterbehind it, reported success while the largest Python package in the repository was not checked. The pre-commit hooks did check these files, so problems were still caught, but only at commit or push time. That is confusing: you run the documented lint command, it passes, and then the push is rejected. This happened twice in one session on the same branch, first for a line over the limit and then for a docstring rule.This registers flake8 for the package and corrects the quote style it reports.
The rewrite is mechanical and quote-only. Every changed file parses to an identical AST before and after, which was checked file by file. The conversion was done with the tokenizer and skipped any literal containing a quote or a backslash; the two that needed a different outer quote were done by hand.
ament_pep257also belongs here, and every other package that ships Python runs it. It is not in this change: the package drifted while it was unchecked, and 563 multi-line docstrings put the summary on the opening line, which is not what the rest of the tree does. Adding that checker means correcting those docstrings, which is a large mechanical change of its own and would collide with the branches currently open. It has its own issue.Issue
Type
Testing
colcon test --packages-select ros2_medkit_integration_tests --ctest-args -L linternow runs two linter tests and both pass. Before this change the same command ran none.ament_flake8reports zero findings for the package after the quote fixes.Every touched file was compared with
ast.dump(ast.parse(...))against its previous version. All eight are identical, so no behaviour changed.Checklist
No behaviour change and no public API change. The CMake comment records why only flake8 is registered for now and why
ament_lint_commonis not used here: it would also apply the C++ style checks to the demo nodes in this package, which is a separate decision.