MCPcopy
hub / github.com/treeverse/dvc / test_apply

Function test_apply

tests/func/experiments/test_apply.py:7–26  ·  view source on GitHub ↗
(tmp_dir, scm, dvc, exp_stage)

Source from the content-addressed store, hash-verified

5
6
7def test_apply(tmp_dir, scm, dvc, exp_stage):
8 from dvc.exceptions import InvalidArgumentError
9
10 results = dvc.experiments.run(exp_stage.addressing, params=["foo=2"], tmp_dir=True)
11 exp_a = first(results)
12
13 dvc.experiments.run(
14 exp_stage.addressing, params=["foo=3"], tmp_dir=True, name="foo"
15 )
16
17 with pytest.raises(InvalidArgumentError):
18 dvc.experiments.apply("bar")
19
20 dvc.experiments.apply(exp_a)
21 assert (tmp_dir / "params.yaml").read_text().strip() == "foo: 2"
22 assert (tmp_dir / "metrics.yaml").read_text().strip() == "foo: 2"
23
24 dvc.experiments.apply("foo")
25 assert (tmp_dir / "params.yaml").read_text().strip() == "foo: 3"
26 assert (tmp_dir / "metrics.yaml").read_text().strip() == "foo: 3"
27
28
29def test_apply_failed(tmp_dir, scm, dvc, failed_exp_stage, mocker):

Callers

nothing calls this directly

Calls 3

runMethod · 0.45
applyMethod · 0.45
read_textMethod · 0.45

Tested by

no test coverage detected