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

params: fix bug when collecting multiple params #3615

Merged
merged 1 commit into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
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
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