Skip to content

Commit

Permalink
ready_fn and self.proc_info will be removed in future (ros2#522)
Browse files Browse the repository at this point in the history
Signed-off-by: Pete Baughman <pete.baughman@apex.ai>
  • Loading branch information
pbaughman authored and sloretz committed Oct 19, 2019
1 parent a073507 commit 7859398
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions rcl/test/rcl/test_rmw_impl_id_check.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ from launch.actions import ExecuteProcess
from launch.actions import OpaqueFunction

import launch_testing
import launch_testing.actions
import launch_testing.asserts
import launch_testing.util

Expand All @@ -33,7 +34,6 @@ import unittest
def generate_test_description(
rmw_implementation_env,
rcl_assert_rmw_id_matches_env,
ready_fn
):
launch_description = LaunchDescription()

Expand All @@ -52,15 +52,15 @@ def generate_test_description(
# Keep the test fixture alive till tests end.
launch_description.add_action(launch_testing.util.KeepAliveProc())
launch_description.add_action(
OpaqueFunction(function=lambda context: ready_fn())
launch_testing.actions.ReadyToTest()
)
return launch_description, locals()

class TestRMWImplementationIDCheck(unittest.TestCase):

def test_process_terminates_in_a_finite_amount_of_time(self, executable_under_test):
def test_process_terminates_in_a_finite_amount_of_time(self, executable_under_test, proc_info):
"""Test that executable under test terminates in a finite amount of time."""
self.proc_info.assertWaitForShutdown(process=executable_under_test, timeout=10)
proc_info.assertWaitForShutdown(process=executable_under_test, timeout=10)

@launch_testing.post_shutdown_test()
class TestRMWImplementationIDCheckAfterShutdown(unittest.TestCase):
Expand Down
13 changes: 7 additions & 6 deletions rcl/test/rcl/test_two_executables.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ from launch.actions import ExecuteProcess
from launch.actions import OpaqueFunction

import launch_testing
import launch_testing.actions
import launch_testing.asserts

import unittest


def generate_test_description(ready_fn):
def generate_test_description():
launch_description = LaunchDescription()

launch_description.add_action(
Expand All @@ -29,25 +30,25 @@ def generate_test_description(ready_fn):
launch_description.add_action(executable_under_test)

launch_description.add_action(
OpaqueFunction(function=lambda context: ready_fn())
launch_testing.actions.ReadyToTest()
)
return launch_description, locals()


class TestTwoExecutables(unittest.TestCase):

def @TEST_NAME@(self, executable_under_test):
def @TEST_NAME@(self, executable_under_test, proc_info):
"""Test that the executable under test terminates after a finite amount of time."""
self.proc_info.assertWaitForShutdown(process=executable_under_test, timeout=10)
proc_info.assertWaitForShutdown(process=executable_under_test, timeout=10)


@launch_testing.post_shutdown_test()
class TestTwoExecutablesAfterShutdown(unittest.TestCase):

def @TEST_NAME@(self, executable_under_test):
def @TEST_NAME@(self, executable_under_test, proc_info):
"""Test that the executable under test finished cleanly."""
launch_testing.asserts.assertExitCodes(
self.proc_info,
proc_info,
[launch_testing.asserts.EXIT_OK],
executable_under_test
)

0 comments on commit 7859398

Please sign in to comment.