Skip to content

Commit

Permalink
Tests for -m and -a. Increased timeout to 5.
Browse files Browse the repository at this point in the history
Signed-off-by: David V. Lu <davidvlu@gmail.com>
  • Loading branch information
DLu committed Apr 24, 2023
1 parent c0269e0 commit 3cc24ec
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion ros2interface/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,27 @@ def test_package_on_test_msgs(self):
)
assert all(interface in output_lines for interface in some_interfaces)

def test_package_on_test_msgs_only_msgs(self):
with self.launch_interface_command(
arguments=['package', 'test_msgs', '-m']
) as interface_command:
assert interface_command.wait_for_shutdown(timeout=5)
assert interface_command.exit_code == launch_testing.asserts.EXIT_OK
output_lines = interface_command.output.splitlines()
assert launch_testing.tools.expect_output(
expected_lines=itertools.repeat(
re.compile(r'test_msgs/msg/[A-z0-9_]+'), len(output_lines)
),
lines=output_lines,
strict=True
)
assert all(interface in output_lines for interface in some_services_from_test_msgs)

def test_package_on_test_msgs_only_srvs(self):
with self.launch_interface_command(
arguments=['package', 'test_msgs', '-s']
) as interface_command:
assert interface_command.wait_for_shutdown(timeout=2)
assert interface_command.wait_for_shutdown(timeout=5)
assert interface_command.exit_code == launch_testing.asserts.EXIT_OK
output_lines = interface_command.output.splitlines()
assert launch_testing.tools.expect_output(
Expand All @@ -216,6 +232,22 @@ def test_package_on_test_msgs_only_srvs(self):
)
assert all(interface in output_lines for interface in some_services_from_test_msgs)

def test_package_on_test_msgs_only_actions(self):
with self.launch_interface_command(
arguments=['package', 'test_msgs', '-a']
) as interface_command:
assert interface_command.wait_for_shutdown(timeout=5)
assert interface_command.exit_code == launch_testing.asserts.EXIT_OK
output_lines = interface_command.output.splitlines()
assert launch_testing.tools.expect_output(
expected_lines=itertools.repeat(
re.compile(r'test_msgs/action/[A-z0-9_]+'), len(output_lines)
),
lines=output_lines,
strict=True
)
assert all(interface in output_lines for interface in some_services_from_test_msgs)

def test_packages(self):
with self.launch_interface_command(arguments=['packages']) as interface_command:
assert interface_command.wait_for_shutdown(timeout=2)
Expand Down

0 comments on commit 3cc24ec

Please sign in to comment.