Skip to content

Commit

Permalink
params: fix bug when collecting multiple params (#3615)
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop authored Apr 9, 2020
1 parent c1ac6bb commit cdef709
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dvc/repo/params/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def _collect_params(repo):
configs[dep.path_info] = copy.copy(dep)
continue

existing = set(configs[dep.path_info].params)
new = set(dep.params)
configs[dep.path_info].params = list(existing.update(new))
params = set(configs[dep.path_info].params)
params.update(set(dep.params))
configs[dep.path_info].params = list(params)

return configs.values()

Expand Down
9 changes: 9 additions & 0 deletions tests/func/params/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ def test_show(tmp_dir, dvc):
assert dvc.params.show() == {"": {"params.yaml": {"foo": "bar"}}}


def test_show_multiple(tmp_dir, dvc):
tmp_dir.gen("params.yaml", "foo: bar\nbaz: qux\n")
dvc.run(fname="foo.dvc", params=["foo"])
dvc.run(fname="baz.dvc", params=["baz"])
assert dvc.params.show() == {
"": {"params.yaml": {"foo": "bar", "baz": "qux"}}
}


def test_show_list(tmp_dir, dvc):
tmp_dir.gen("params.yaml", "foo:\n- bar\n- baz\n")
dvc.run(params=["foo"])
Expand Down

0 comments on commit cdef709

Please sign in to comment.