Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use launch_testing features that will be deprecated #522

Merged
merged 1 commit into from
Oct 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
)