Skip to content

Backport robust pytest collection hooks to Humble - #991

Open
Old-Ding wants to merge 1 commit into
ros2:humblefrom
Old-Ding:codex/humble-launch-testing-pytest-hooks
Open

Backport robust pytest collection hooks to Humble#991
Old-Ding wants to merge 1 commit into
ros2:humblefrom
Old-Ding:codex/humble-launch-testing-pytest-hooks

Conversation

@Old-Ding

Copy link
Copy Markdown

Summary

Fixes #979

Testing

  • reproduced the Humble baseline failure with pytest 9.1.1: PluginValidationError because pytest_pycollect_makemodule(path, parent) no longer matches the hookspec
  • reproduced the Humble baseline over-collection with pytest 8.4.2
  • pytest 7.4.4: 83 launch_testing tests passed; launch test collection passed
  • pytest 8.4.2: 83 launch_testing tests passed; launch test collection passed
  • pytest 9.1.1: 83 launch_testing tests passed; launch test collection passed
  • targeted ament_flake8 on both changed files
  • ament_copyright and ament_pep257
  • compileall, UTF-8 without BOM, CRLF, added-line 100-column check, and git diff --check

The two changed files exactly match the versions already merged and CI-validated on the lyrical branch in #973.

Did you use Generative AI?

Yes. OpenAI Codex was used to trace the Humble failure, separate the launch_testing backport from unrelated launch_pytest prerequisites, apply the already-merged Lyrical implementation, and run the pytest 7/8/9 regression matrix. The contributor reviewed the final two-file diff and test results.

Backport the final launch_testing hook behavior from ros2#972 and ros2#974 so Humble accepts the pytest 9 module_path hook while preserving pytest 7 and 8 collection. Limit eager imports to Python test modules and keep the legacy path argument in the custom hook specification for older plugins.

Co-authored-by: Michael Carroll <mjcarroll.oss@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
@mergify

mergify Bot commented Jul 12, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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.

1 participant