mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
dvc: implement params support for pipeline file (#3694)
* dvc: implement params support for pipeline file * reorganize dump/load of params * add tests for params * fix order of dictionary in Python 3.5
This commit is contained in:
@@ -102,3 +102,20 @@ def test_diff_with_unchanged(tmp_dir, scm, dvc):
|
||||
"xyz": {"old": "val", "new": "val"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def test_pipeline_tracked_params(tmp_dir, scm, dvc, run_copy):
|
||||
from dvc.dvcfile import PIPELINE_FILE
|
||||
|
||||
tmp_dir.gen({"foo": "foo", "params.yaml": "foo: bar\nxyz: val"})
|
||||
run_copy("foo", "bar", name="copy-foo-bar", params=["foo,xyz"])
|
||||
|
||||
scm.add(["params.yaml", PIPELINE_FILE])
|
||||
scm.commit("add stage")
|
||||
|
||||
tmp_dir.scm_gen("params.yaml", "foo: baz\nxyz: val", commit="baz")
|
||||
tmp_dir.scm_gen("params.yaml", "foo: qux\nxyz: val", commit="qux")
|
||||
|
||||
assert dvc.params.diff(a_rev="HEAD~2") == {
|
||||
"params.yaml": {"foo": {"old": "bar", "new": "qux"}}
|
||||
}
|
||||
|
||||
@@ -42,3 +42,19 @@ def test_show_branch(tmp_dir, scm, dvc):
|
||||
"working tree": {"params.yaml": {"foo": "bar"}},
|
||||
"branch": {"params.yaml": {"foo": "baz"}},
|
||||
}
|
||||
|
||||
|
||||
def test_pipeline_tracked_params(tmp_dir, scm, dvc, run_copy):
|
||||
from dvc.dvcfile import PIPELINE_FILE
|
||||
|
||||
tmp_dir.gen({"foo": "foo", "params.yaml": "foo: bar\nxyz: val"})
|
||||
run_copy("foo", "bar", name="copy-foo-bar", params=["foo,xyz"])
|
||||
scm.add(["params.yaml", PIPELINE_FILE])
|
||||
scm.commit("add stage")
|
||||
|
||||
tmp_dir.scm_gen("params.yaml", "foo: baz\nxyz: val", commit="baz")
|
||||
tmp_dir.scm_gen("params.yaml", "foo: qux\nxyz: val", commit="qux")
|
||||
|
||||
assert dvc.params.show(revs=["master"]) == {
|
||||
"master": {"params.yaml": {"foo": "qux", "xyz": "val"}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user