mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-25 23:09:49 +01:00
add tests
This commit is contained in:
committed by
David de la Iglesia Castro
parent
df60f5d9bf
commit
28402dedf1
@@ -1,3 +1,5 @@
|
||||
from os.path import join
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.utils import relpath
|
||||
@@ -241,3 +243,28 @@ def test_diff_without_targets_specified(tmp_dir, dvc, scm, file):
|
||||
"y": {"new": "100", "old": None},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"dvcfile, params_file",
|
||||
[
|
||||
("dvc.yaml", "my_params.yaml"),
|
||||
("dir/dvc.yaml", "my_params.yaml"),
|
||||
("dir/dvc.yaml", join("..", "my_params.yaml")),
|
||||
],
|
||||
)
|
||||
def test_diff_top_level_params(tmp_dir, dvc, scm, dvcfile, params_file):
|
||||
directory = (tmp_dir / dvcfile).parent
|
||||
directory.mkdir(exist_ok=True)
|
||||
(tmp_dir / dvcfile).dump({"params": [params_file]})
|
||||
|
||||
params_file = directory / params_file
|
||||
params_file.dump({"foo": 3})
|
||||
scm.add_commit([params_file, tmp_dir / dvcfile], message="add params")
|
||||
|
||||
params_file.dump({"foo": 5})
|
||||
assert dvc.params.diff() == {
|
||||
relpath(directory / params_file): {
|
||||
"foo": {"diff": 2, "new": 5, "old": 3}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user