Skip to content

Expand mocking of python variables to fix 1) -pip ending, 2) replace "-" with "_"#206

Merged
tfoote merged 1 commit into
ros-infrastructure:mainfrom
rkent:expand-guessed-mock
Nov 12, 2025
Merged

Expand mocking of python variables to fix 1) -pip ending, 2) replace "-" with "_"#206
tfoote merged 1 commit into
ros-infrastructure:mainfrom
rkent:expand-guessed-mock

Conversation

@rkent

@rkent rkent commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Fixes #200

Generated-by: Portions of this commit may include code completion from github.copilot version 1.372.0 or later

Python modules need to be mocked if they are imported into python files. Although not ideal, rosdoc2 tries to automate this process by parsing the rosdep key and trying to guess the python module. This PR adds two additional categories to the guess: remove any '-pip' at the end, and replace hyphens with underscores.

There are additional, unfixed reasons why the automatic mocking might fail, but this is still a net improvement.

…'-' with '_'

Signed-off-by: R Kent James <kent@caspia.com>
Generated-by: Portions of this commit may include code completion from github.copilot version 1.372.0 or later
@rkent rkent requested review from audrow and tfoote as code owners October 3, 2025 21:15

@tfoote tfoote left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already guessing so adding these heuristics doesn't seem bad to improve coverage.

@tfoote tfoote merged commit a64ddc5 into ros-infrastructure:main Nov 12, 2025
5 checks passed
@rkent rkent deleted the expand-guessed-mock branch November 22, 2025 17:19
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.

Mocking of python modules fails if rosdep name ends in "-pip"

2 participants