Skip to content

test(integration): lint the Python in ros2_medkit_integration_tests - #598

Open
bburda wants to merge 1 commit into
mainfrom
fix/lint-integration-tests
Open

test(integration): lint the Python in ros2_medkit_integration_tests#598
bburda wants to merge 1 commit into
mainfrom
fix/lint-integration-tests

Conversation

@bburda

@bburda bburda commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

ros2_medkit_integration_tests has 91 Python files and registered no linter. Its if(BUILD_TESTING) block set up the launch tests but never called ament_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, and colcon test --ctest-args -L linter behind 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_pep257 also 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

  • Bug fix
  • New feature or tests
  • Breaking change
  • Documentation only

Testing

colcon test --packages-select ros2_medkit_integration_tests --ctest-args -L linter now runs two linter tests and both pass. Before this change the same command ran none.

ament_flake8 reports 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

  • Breaking changes are clearly described (and announced in docs / changelog if needed)
  • Tests were added or updated if needed
  • Docs were updated if behavior or public API changed

No behaviour change and no public API change. The CMake comment records why only flake8 is registered for now and why ament_lint_common is not used here: it would also apply the C++ style checks to the demo nodes in this package, which is a separate decision.

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
Copilot AI lite review requested due to automatic review settings August 5, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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() under if(BUILD_TESTING) for the integration tests package.
  • Add the required ament_cmake_flake8 test dependency in package.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.

@bburda bburda self-assigned this Aug 5, 2026
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.

Python files in ros2_medkit_integration_tests are not linted by the test gate

2 participants