Files
dvc/tests/unit/test_params.py
T
Paweł RedzyńskiandJorge Orpinel c39f91ecf4 params: read from ParamsDependency if possible (#5550)
* params: read from ParamsDependency if possible

* params: introduce include_untracked flag

* params: include untracked upon targets

* experiments: add option to show tracked params

* fixing test

* params: rename tracked to deps

* params: roll back to default params.yaml behavior

* experiments: add option to show only used params on diff

* Update dvc/command/experiments.py

Co-authored-by: Jorge Orpinel <[email protected]>

* Update dvc/command/experiments.py

Co-authored-by: Jorge Orpinel <[email protected]>

* Update dvc/command/params.py

Co-authored-by: Jorge Orpinel <[email protected]>

Co-authored-by: Jorge Orpinel <[email protected]>
2021-04-12 17:08:02 +02:00

46 lines
1.2 KiB
Python

import os
from dvc.utils.serialize import dumps_yaml
def test_params_order(tmp_dir, dvc):
tmp_dir.gen(
{
"params.yaml": dumps_yaml({"p": 1}),
"params1.yaml": dumps_yaml({"p1": 1}),
"sub": {"params2.yaml": dumps_yaml({"p2": 1})},
}
)
params_path = os.path.join("..", "params.yaml")
p2_path = os.path.join("sub", "params2.yaml")
dvc.stage.add(
params=[{p2_path: ["p2"]}, {"params1.yaml": ["p1"]}],
cmd="cmd1",
name="stage1",
)
with (tmp_dir / "sub").chdir():
dvc.stage.add(params=[{params_path: ["p"]}], cmd="cmd2", name="stage2")
# params are sorted during dumping, therefore p1 is first
assert list(dvc.params.show()[""]) == [
"params1.yaml",
p2_path,
"params.yaml",
]
def test_repro_unicode(tmp_dir, dvc):
tmp_dir.gen({"settings.json": '{"Ω_value": 1}'})
stage = dvc.stage.add(
params=[{"settings.json": ["Ω_value"]}], cmd="cmd", name="stage1"
)
assert dvc.reproduce(dry=True) == [stage]
stage.cmd = "foo"
stage.dump()
dvc.remove(stage.name)
assert not (tmp_dir / "dvc.yaml").exists()
assert not (tmp_dir / "dvc.lock").exists()