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

[bug] fixes #1158 #1159

Merged
merged 7 commits into from
Oct 4, 2017
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
2 changes: 2 additions & 0 deletions tools/roslaunch/src/roslaunch/xmlloader.py
Original file line number Diff line number Diff line change
@@ -370,6 +370,7 @@ def _node_tag(self, tag, context, ros_config, default_machine, is_test=False, ve

child_ns = self._ns_clear_params_attr('node', tag, context, ros_config, node_name=name)
param_ns = child_ns.child(name)
param_ns.params = [] # This is necessary because child() does not make a copy of the param list.

# required attributes
pkg, node_type = self.reqd_attrs(tag, context, ('pkg', 'type'))
@@ -649,6 +650,7 @@ def _recurse_load(self, ros_config, tags, context, default_machine, is_core, ver
if ifunless_test(self, tag, context):
self._check_attrs(tag, context, ros_config, XmlLoader.GROUP_ATTRS)
child_ns = self._ns_clear_params_attr(name, tag, context, ros_config)
child_ns.params = list(child_ns.params) # copy is needed here to enclose new params
default_machine = \
self._recurse_load(ros_config, tag.childNodes, child_ns, \
default_machine, is_core, verbose)
7 changes: 7 additions & 0 deletions tools/roslaunch/test/unit/test_roslaunch_dump_params.py
Original file line number Diff line number Diff line change
@@ -77,6 +77,10 @@ def test_roslaunch(self):
'/node_rosparam/dict1/shoulders': 2,
'/node_rosparam/dict1/knees': 3,
'/node_rosparam/dict1/toes': 4,
'/node_rosparam/tilde1': 'foo',
'/node_rosparam/local_param': 'baz',

'/node_rosparam2/tilde1': 'foo',
Copy link
Member

@mikepurvis mikepurvis Sep 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to do a negative test here, since that was the actual problem in the first place? eg:

    '/node_rosparam2/tilde2': None

Might need something changed in the python file to correctly handle it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the equality tests (val == output_val and assertEquals(val, output_val)) already covered that case. However, for clarity, I added the negative tests at the bottom.


'/inline_str': 'value1',
'/inline_list': [1, 2, 3, 4],
@@ -99,3 +103,6 @@ def test_roslaunch(self):
elif v != output_val[k]:
self.fail("key [%s] value [%s] does not match output: %s"%(k, v, output_val[k]))
self.assertEquals(val, output_val)
for k in ('/node_rosparam/tilde2', '/node_rosparam2/tilde2', '/node_rosparam2/local_param'):
if k in output_val:
self.fail("key [%s] should not be in output: %s"%(k, output_val))
6 changes: 6 additions & 0 deletions tools/roslaunch/test/xml/test-dump-rosparam.launch
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
<launch>

<param name="~tilde1" value="foo" />
<rosparam file="$(find roslaunch)/test/dump-params.yaml" command="load" />

<group ns="rosparam">
<param name="~tilde2" value="bar" />
<rosparam file="$(find roslaunch)/test/dump-params.yaml" command="load" />
</group>

<node pkg="package" type="test_base" name="node_rosparam">
<param name="local_param" value="baz" />
<rosparam file="$(find roslaunch)/test/dump-params.yaml" command="load" />
</node>

<node pkg="package" type="test_base" name="node_rosparam2">
</node>

<rosparam param="inline_str">value1</rosparam>
<rosparam param="inline_list">[1, 2, 3, 4]</rosparam>
<rosparam param="inline_dict">{key1: value1, key2: value2}</rosparam>