params: fix bug when collecting multiple params (#3615)

This commit is contained in:
Ruslan Kuprieiev
2020-04-09 15:41:35 +03:00
committed by GitHub
parent c1ac6bb06b
commit cdef709e8a
2 changed files with 12 additions and 3 deletions
+3 -3
View File
@@ -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()
+9
View File
@@ -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"])