From 1fb519af070800f9bd799151f1f89a031cba3dac Mon Sep 17 00:00:00 2001 From: Pete Baughman Date: Fri, 18 Oct 2019 14:49:56 -0700 Subject: [PATCH] ready_fn and self.proc_info will be removed in future Signed-off-by: Pete Baughman --- rcl/test/rcl/test_rmw_impl_id_check.py.in | 8 ++++---- rcl/test/rcl/test_two_executables.py.in | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/rcl/test/rcl/test_rmw_impl_id_check.py.in b/rcl/test/rcl/test_rmw_impl_id_check.py.in index 0c293bbae..c97068781 100644 --- a/rcl/test/rcl/test_rmw_impl_id_check.py.in +++ b/rcl/test/rcl/test_rmw_impl_id_check.py.in @@ -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 @@ -33,7 +34,6 @@ import unittest def generate_test_description( rmw_implementation_env, rcl_assert_rmw_id_matches_env, - ready_fn ): launch_description = LaunchDescription() @@ -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): diff --git a/rcl/test/rcl/test_two_executables.py.in b/rcl/test/rcl/test_two_executables.py.in index d2b97ebfc..8e56d56fa 100644 --- a/rcl/test/rcl/test_two_executables.py.in +++ b/rcl/test/rcl/test_two_executables.py.in @@ -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( @@ -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 )