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] Remove usage of deprecated std_msgs and std_srvs packages #516

Merged
merged 2 commits into from
May 22, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 0 additions & 2 deletions ros2interface/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
<test_depend>ament_xmllint</test_depend>
<test_depend>python3-pytest</test_depend>
<test_depend>ros_testing</test_depend>
<test_depend>std_msgs</test_depend>
<test_depend>std_srvs</test_depend>
<test_depend>test_msgs</test_depend>

<export>
Expand Down
2 changes: 1 addition & 1 deletion ros2interface/ros2interface/verb/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PackageVerb(VerbExtension):
def add_arguments(self, parser, cli_name):
arg = parser.add_argument(
'package_name',
help="Name of the ROS package (e.g. 'std_msgs, std_srvs, etc.')")
help="Name of the ROS package (e.g. 'example_interfaces')")
arg.completer = package_name_completer

def main(self, *, args):
Expand Down
2 changes: 1 addition & 1 deletion ros2interface/ros2interface/verb/proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ProtoVerb(VerbExtension):
def add_arguments(self, parser, cli_name):
arg = parser.add_argument(
'type',
help="Show an interface definition (e.g. 'std_msgs/msg/String')")
help="Show an interface definition (e.g. 'example_interfaces/msg/String')")
arg.completer = type_completer
parser.add_argument(
'--no-quotes', action='store_true',
Expand Down
2 changes: 1 addition & 1 deletion ros2interface/ros2interface/verb/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ShowVerb(VerbExtension):
def add_arguments(self, parser, cli_name):
arg = parser.add_argument(
'type',
help="Show an interface definition (e.g. 'std_msgs/msg/String')")
help="Show an interface definition (e.g. 'example_interfaces/msg/String')")
arg.completer = type_completer

def main(self, *, args):
Expand Down
105 changes: 45 additions & 60 deletions ros2interface/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@
allow_module_level=True)


some_messages_from_std_msgs = [
'std_msgs/msg/Bool',
'std_msgs/msg/Float32',
'std_msgs/msg/Float64',
some_messages_from_test_msgs = [
'test_msgs/msg/BasicTypes',
'test_msgs/msg/Constants',
'test_msgs/msg/Strings',
]

some_services_from_std_srvs = [
'std_srvs/srv/Empty',
'std_srvs/srv/SetBool',
'std_srvs/srv/Trigger',
some_services_from_test_msgs = [
'test_msgs/srv/Arrays',
'test_msgs/srv/BasicTypes',
'test_msgs/srv/Empty',
]

some_actions_from_test_msgs = [
'test_msgs/action/Fibonacci'
]

some_interfaces = (
some_messages_from_std_msgs +
some_services_from_std_srvs +
some_messages_from_test_msgs +
some_services_from_test_msgs +
some_actions_from_test_msgs
)

Expand Down Expand Up @@ -126,7 +126,7 @@ def test_list_messages(self):
strict=True
)
assert launch_testing.tools.expect_output(
expected_lines=some_messages_from_std_msgs,
expected_lines=some_messages_from_test_msgs,
lines=output_lines,
strict=False
)
Expand All @@ -146,7 +146,7 @@ def test_list_services(self):
strict=True
)
assert launch_testing.tools.expect_output(
expected_lines=some_services_from_std_srvs,
expected_lines=some_services_from_test_msgs,
lines=output_lines,
strict=False
)
Expand Down Expand Up @@ -183,38 +183,6 @@ def test_package_on_nonexistent_package(self):
strict=True
)

def test_package_on_std_msgs(self):
with self.launch_interface_command(
arguments=['package', 'std_msgs']
) as interface_command:
assert interface_command.wait_for_shutdown(timeout=2)
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'std_msgs/msg/[A-z0-9_]+'), len(output_lines)
),
lines=output_lines,
strict=True
)
assert all(msg in output_lines for msg in some_messages_from_std_msgs)

def test_package_on_std_srvs(self):
with self.launch_interface_command(
arguments=['package', 'std_srvs']
) as interface_command:
assert interface_command.wait_for_shutdown(timeout=2)
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'std_srvs/srv/[A-z0-9_]+'), len(output_lines)
),
lines=output_lines,
strict=True
)
assert all(srv in output_lines for srv in some_services_from_std_srvs)

def test_package_on_test_msgs(self):
with self.launch_interface_command(
arguments=['package', 'test_msgs']
Expand All @@ -229,15 +197,13 @@ def test_package_on_test_msgs(self):
lines=output_lines,
strict=True
)
assert all(action in output_lines for action in some_actions_from_test_msgs)
assert all(action in output_lines for action in some_interfaces)
jacobperron marked this conversation as resolved.
Show resolved Hide resolved

def test_packages(self):
with self.launch_interface_command(arguments=['packages']) as interface_command:
assert interface_command.wait_for_shutdown(timeout=2)
assert interface_command.exit_code == launch_testing.asserts.EXIT_OK
output_lines = interface_command.output.splitlines()
assert 'std_msgs' in output_lines
assert 'std_srvs' in output_lines
assert 'test_msgs' in output_lines

def test_packages_with_messages(self):
Expand All @@ -247,8 +213,6 @@ def test_packages_with_messages(self):
assert interface_command.wait_for_shutdown(timeout=2)
assert interface_command.exit_code == launch_testing.asserts.EXIT_OK
output_lines = interface_command.output.splitlines()
assert 'std_msgs' in output_lines
assert 'std_srvs' not in output_lines
assert 'test_msgs' in output_lines

def test_packages_with_services(self):
Expand All @@ -258,8 +222,6 @@ def test_packages_with_services(self):
assert interface_command.wait_for_shutdown(timeout=2)
assert interface_command.exit_code == launch_testing.asserts.EXIT_OK
output_lines = interface_command.output.splitlines()
assert 'std_msgs' not in output_lines
assert 'std_srvs' in output_lines
assert 'test_msgs' in output_lines

def test_packages_with_actions(self):
Expand All @@ -269,36 +231,59 @@ def test_packages_with_actions(self):
assert interface_command.wait_for_shutdown(timeout=2)
assert interface_command.exit_code == launch_testing.asserts.EXIT_OK
output_lines = interface_command.output.splitlines()
assert 'std_msgs' not in output_lines
assert 'std_srvs' not in output_lines
assert 'test_msgs' in output_lines

def test_show_message(self):
with self.launch_interface_command(
arguments=['show', 'std_msgs/msg/String']
arguments=['show', 'test_msgs/msg/Nested']
) as interface_command:
assert interface_command.wait_for_shutdown(timeout=2)
assert interface_command.exit_code == launch_testing.asserts.EXIT_OK
assert launch_testing.tools.expect_output(
expected_lines=[
'string data'
'BasicTypes basic_types_value'
],
text=interface_command.output,
strict=True
)

def test_show_service(self):
with self.launch_interface_command(
arguments=['show', 'std_srvs/srv/SetBool']
arguments=['show', 'test_msgs/srv/BasicTypes']
) as interface_command:
assert interface_command.wait_for_shutdown(timeout=2)
assert interface_command.exit_code == launch_testing.asserts.EXIT_OK
assert launch_testing.tools.expect_output(
expected_lines=[
'bool data # e.g. for hardware enabling / disabling',
'bool bool_value',
'byte byte_value',
'char char_value',
'float32 float32_value',
'float64 float64_value',
'int8 int8_value',
'uint8 uint8_value',
'int16 int16_value',
'uint16 uint16_value',
'int32 int32_value',
'uint32 uint32_value',
'int64 int64_value',
'uint64 uint64_value',
'string string_value',
'---',
'bool success # indicate successful run of triggered service',
'string message # informational, e.g. for error messages'
'bool bool_value',
'byte byte_value',
'char char_value',
'float32 float32_value',
'float64 float64_value',
'int8 int8_value',
'uint8 uint8_value',
'int16 int16_value',
'uint16 uint16_value',
'int32 int32_value',
'uint32 uint32_value',
'int64 int64_value',
'uint64 uint64_value',
'string string_value',
],
text=interface_command.output,
strict=True
Expand Down Expand Up @@ -339,7 +324,7 @@ def test_show_not_a_package(self):

def test_show_not_an_interface(self):
with self.launch_interface_command(
arguments=['show', 'std_msgs/msg/NotAMessageTypeName']
arguments=['show', 'test_msgs/msg/NotAMessageTypeName']
) as interface_command:
assert interface_command.wait_for_shutdown(timeout=2)
assert interface_command.exit_code == 1
Expand Down