launch_ros
launch_ros copied to clipboard
Unit tests for composition actions
This is the start of unit tests for composition. It depends on #8, so if you'd like to run locally make a branch that merges this branch and #8 .
Issues to resolve:
- How to make
launch_test test_launch_ros/test/rostest/composition.test.py
part of the test suite in a pure python package? - Add log_level to
ComposableNodeDescription
-
Edit: resolved by #16
LaunchComposableNodes
returns actions to be executed when the container emits the eventOnProcessStart
, but that means they won't trigger if the container process is already started. At the moment composable nodes launching only works via thecomposable_node_descriptions
on the container action - How to handle failures to launch nodes? Should emit an event so other launch actions can do something if a node fails to launch
- How to unload nodes? Should emit an event with the node unique_id so it's possible to make an unload action
@sloretz #8 just got merged, mind to check if this is still working and put it on review (or not)?
@hidmic The test passes running with:
launch_test src/ros2/launch_ros/test_launch_ros/test/rostest/composition.test.py
This isn't ready to be merged as the test is not run with colcon test --packages-select test_launch_ros
. I'm not sure how to make a launch test part of the test suite for a pure python package. Is there a pytest plugin for launch-test? If not, a quick alternative would be a test file that called launch_test
using subprocess
.
That's a good point, we don't have a tool for that atm. I've filed an issue https://github.com/ros2/launch/issues/237.
@sloretz with https://github.com/ros2/launch/pull/236 now we can call launch_test
from Python code to some extent.
@sloretz once https://github.com/ros2/launch/pull/312 goes in, we can have launch tests in pure Python packages.
A few issues that may be relevant:
- https://github.com/ros2/launch_ros/issues/107
- https://github.com/ros2/launch_ros/issues/108
@sloretz I rebased this and I'm going to try and resurrect it in general, hope you don't mind.
@wjwwood friendly ping
I do not remember what I was going to do to "resurrect" these tests...
I'll re-review it, but I'm afraid after dropping the ball on this I've lost context.
I'm guessing it needs to be updated to use the "launch tests from python packages" updates and/or changed to not use ready_fn
in favor of pytest.