Skip to content

Commit

Permalink
test multiple parameter files via CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
sloretz committed Jun 5, 2018
1 parent dcfb8e8 commit 5c7e72b
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test_cli/test/test_params_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,44 @@ def check_params():
command = (node_fixture['executable'], '__params:=' + yaml_file.name)
actual_test = make_coroutine_test(check_func=check_params)
assert 0 == launch_process_and_coroutine(command, actual_test)


def test_multiple_parameter_files(node_fixture):
def check_params():
nonlocal node_fixture
resp = get_params(node_fixture['node'], ('i1', 'i2', 'i3'))
if 3 == len(resp.values):
assert ParameterType.PARAMETER_INTEGER == resp.values[0].type
assert ParameterType.PARAMETER_INTEGER == resp.values[1].type
assert ParameterType.PARAMETER_INTEGER == resp.values[2].type
assert 42 == resp.values[0].integer_value
assert 12345 == resp.values[1].integer_value
assert -27 == resp.values[2].integer_value
return True
print(resp)
return False

with tempfile.NamedTemporaryFile(mode='w') as first_yaml_file:
first_yaml_file.write("""
initial_params_node:
ros__parameters:
i1: 42
i2: -27
""")
first_yaml_file.flush()
with tempfile.NamedTemporaryFile(mode='w') as second_yaml_file:
second_yaml_file.write("""
initial_params_node:
ros__parameters:
i2: 12345
i3: -27
""")
second_yaml_file.flush()

command = (
node_fixture['executable'],
'__params:=' + first_yaml_file.name,
'__params:=' + second_yaml_file.name
)
actual_test = make_coroutine_test(check_func=check_params)
assert 0 == launch_process_and_coroutine(command, actual_test)

0 comments on commit 5c7e72b

Please sign in to comment.