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

[ros2interface] Fix tests #386

Merged
merged 1 commit into from
Oct 25, 2019
Merged
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
40 changes: 8 additions & 32 deletions ros2interface/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,13 @@ def test_list_interfaces(self):
output_lines = filter_(interface_command.output).splitlines()
assert launch_testing.tools.expect_output(
expected_lines=itertools.repeat(
re.compile(r'\s*[A-z0-9_]+/[A-z0-9_]+'), len(output_lines)
re.compile(r'\s*[A-z0-9_]+(/[A-z0-9_]+)+'), len(output_lines)
),
lines=output_lines,
strict=True
)
some_interfaces_without_ns = []
for ifc in some_interfaces:
parts = ifc.split('/')
some_interfaces_without_ns.append(
'/'.join([parts[0], *parts[2:]])
)
assert launch_testing.tools.expect_output(
expected_lines=some_interfaces_without_ns,
expected_lines=some_interfaces,
lines=output_lines,
strict=False
)
Expand All @@ -116,20 +110,14 @@ def test_list_messages(self):
assert launch_testing.tools.expect_output(
expected_lines=itertools.chain(
['Messages:'], itertools.repeat(
re.compile(r'\s*[A-z0-9_]+/[A-z0-9_]+'), len(output_lines) - 1
re.compile(r'\s*[A-z0-9_]+(/[A-z0-9_]+)+'), len(output_lines) - 1
)
),
lines=output_lines,
strict=True
)
some_messages_from_std_msgs_without_ns = []
for msg in some_messages_from_std_msgs:
parts = msg.split('/')
some_messages_from_std_msgs_without_ns.append(
'/'.join([parts[0], *parts[2:]])
)
assert launch_testing.tools.expect_output(
expected_lines=some_messages_from_std_msgs_without_ns,
expected_lines=some_messages_from_std_msgs,
lines=output_lines,
strict=False
)
Expand All @@ -142,20 +130,14 @@ def test_list_services(self):
assert launch_testing.tools.expect_output(
expected_lines=itertools.chain(
['Services:'], itertools.repeat(
re.compile(r'\s*[A-z0-9_]+/[A-z0-9_]+'), len(output_lines) - 1
re.compile(r'\s*[A-z0-9_]+(/[A-z0-9_]+)+'), len(output_lines) - 1
)
),
lines=output_lines,
strict=True
)
some_services_from_std_srvs_without_ns = []
for srv in some_services_from_std_srvs:
parts = srv.split('/')
some_services_from_std_srvs_without_ns.append(
'/'.join([parts[0], *parts[2:]])
)
assert launch_testing.tools.expect_output(
expected_lines=some_services_from_std_srvs_without_ns,
expected_lines=some_services_from_std_srvs,
lines=output_lines,
strict=False
)
Expand All @@ -168,20 +150,14 @@ def test_list_actions(self):
assert launch_testing.tools.expect_output(
expected_lines=itertools.chain(
['Actions:'], itertools.repeat(
re.compile(r'\s*[A-z0-9_]+/[A-z0-9_]+'), len(output_lines) - 1
re.compile(r'\s*[A-z0-9_]+(/[A-z0-9_]+)+'), len(output_lines) - 1
)
),
lines=output_lines,
strict=True
)
some_actions_from_test_msgs_without_ns = []
for action in some_actions_from_test_msgs:
parts = action.split('/')
some_actions_from_test_msgs_without_ns.append(
'/'.join([parts[0], *parts[2:]])
)
assert launch_testing.tools.expect_output(
expected_lines=some_actions_from_test_msgs_without_ns,
expected_lines=some_actions_from_test_msgs,
lines=output_lines,
strict=False
)
Expand Down