ModuleNotFoundError python unit test
Nobody has claimed this yet.
- #348 by @christophfroehlich — closed without merging
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with test/test_parameters.py and generate_parameter_module_example/minimal_publisher.py, then read the linked pull request #348 and related issues #192 and #141 to see what work is already underway. Reproduce the failure using the listed colcon build and colcon test commands. Done means the module imports successfully during the test run, not only when running pytest directly in the test folder.
Written by the indexing model from the issue text.
Description
Hello,
I am having errors when running colcon test for unit tests of python modules that use parameters generated by generate_parameter_library.
I have created a simple unit test that reproduces this error using your example_python on this branch: bug/python-example-unit-test. It simply imports the minimal_publisher module.
Here are the steps to reproduce the error:
rosdep updaterosdep install --rosdistro humblecolcon build --cmake-args -DBUILD_TESTING=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=On --event-handlers console_direct+ --merge-installcolcon test --merge-install --packages-select generate_parameter_module_example --event-handlers console_cohesion+ log_command+ summary+ --return-code-on-test-failure
The result should give something like the following:
==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
/usr/lib/python3/dist-packages/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3/dist-packages/_pytest/python.py:200: in pytest_collect_file
module: Module = ihook.pytest_pycollect_makemodule(path=path, parent=parent)
/usr/lib/python3/dist-packages/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/opt/ros/humble/lib/python3.10/site-packages/launch_testing/pytest/hooks.py:193: in pytest_pycollect_makemodule
entrypoint = find_launch_test_entrypoint(path)
/opt/ros/humble/lib/python3.10/site-packages/launch_testing/pytest/hooks.py:186: in find_launch_test_entrypoint
module = path.pyimport()
/usr/lib/python3/dist-packages/py/_path/local.py:704: in pyimport
__import__(modname)
/usr/lib/python3/dist-packages/_pytest/assertion/rewrite.py:170: in exec_module
exec(co, module.__dict__)
test/test_parameters.py:3: in <module>
import generate_parameter_module_example.minimal_publisher
generate_parameter_module_example/minimal_publisher.py:30: in <module>
from generate_parameter_module_example.admittance_parameters import (
E ModuleNotFoundError: No module named 'generate_parameter_module_example.admittance_parameters'
- generated xml file: /home/user/ws/build/generate_parameter_module_example/pytest.xml -
=========================== short test summary info ============================
ERROR - ModuleNotFoundError: No module named 'generate_parameter_module_exam...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.11s ===============================
Note: It seems to work if you run pytest directly inside the test/ folder.
@christophfroehlich I'm not sure who to tag, but I appreciate any help with this. Thanks!
(possible related issues: #192, #141)
Context:
- Ros Distro: Humble
- Ubuntu 22.04
- Dominant language
- Python
- Stars
- 385
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PickNikRobotics/generate_parameter_library
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
PickNikRobotics/generate_parameter_library#392 · 2 comments ·
-
GCC 15 emits -Wfree-nonheap-object for generated string one_of validationPossibly taken @tylerjw claimed this 19 days ago. Open
PickNikRobotics/generate_parameter_library#389 · 1 comment · 1 assignee ·
-
Feature request: math in the yamlPossibly taken @tylerjw claimed this 19 days ago. Open
PickNikRobotics/generate_parameter_library#381 · 2 comments · 1 reaction · 1 assignee ·
-
Validator reference (bounds<>/element_bounds<> etc.) is hard to find inside the READMEMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
PickNikRobotics/generate_parameter_library#377 · 1 comment ·
-
`.inf` not within floating point rangePossibly taken @christianrauch claimed this 69 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 30/100
PickNikRobotics/generate_parameter_library#376 · 3 comments ·
All issues in PickNikRobotics/generate_parameter_library
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
sierra-research/tau2-bench#635 ·
Maintainers usually reply within 1 day
-
The add-ssm-model skill requires a Cython simulator; the contributing guide allows Python onesPossibly taken @fmuia claimed this today. Opendocumentation skill
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
lnccbrown/ssm-simulators#406 ·
Maintainers usually reply within 4 days
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
btclib-org/btclib-ecc#309 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
jbacalso24/mimry#459 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] POST /revoke with a FastMCP access token is a silent no-op (ownership gate never matches)Openauth bug high-priority
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day