Skip to content

Commit

Permalink
[launch_testing_ros] Fix example launch test
Browse files Browse the repository at this point in the history
Fixes #97

Inject the ROS-specific preamble so that the test can be run as described in the README.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
jacobperron committed Jan 3, 2020
1 parent c37340d commit 2cedc8b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions launch_testing_ros/test/examples/talker_listener_launch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import unittest
import uuid

import launch
import launch_ros
import launch_ros.actions
import launch_testing.actions
Expand Down Expand Up @@ -51,13 +50,15 @@ def generate_test_description():
remappings=[('chatter', 'listener_chatter')]
)

# Note, if we use 'ros2 test', then this default description is injected for us
ld = launch_ros.get_default_launch_description()
ld.add_action(talker_node)
ld.add_action(listener_node)
# Start tests right away - no need to wait for anything
ld.add_action(launch_testing.actions.ReadyToTest())

return (
launch.LaunchDescription([
talker_node,
listener_node,
# Start tests right away - no need to wait for anything
launch_testing.actions.ReadyToTest(),
]),
ld,
{
'talker': talker_node,
'listener': listener_node,
Expand Down

0 comments on commit 2cedc8b

Please sign in to comment.