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

Function test_experiment_exists

tests/func/experiments/test_experiments.py:61–90  ·  view source on GitHub ↗
(tmp_dir, scm, dvc, exp_stage, mocker, workspace)

Source from the content-addressed store, hash-verified

59
60
61def test_experiment_exists(tmp_dir, scm, dvc, exp_stage, mocker, workspace):
62 dvc.experiments.run(
63 exp_stage.addressing,
64 name="foo",
65 params=["foo=2"],
66 tmp_dir=not workspace,
67 )
68
69 new_mock = mocker.spy(BaseStashQueue, "_stash_exp")
70 with pytest.raises(ExperimentExistsError):
71 dvc.experiments.run(
72 exp_stage.addressing,
73 name="foo",
74 params=["foo=3"],
75 tmp_dir=not workspace,
76 )
77 new_mock.assert_not_called()
78
79 results = dvc.experiments.run(
80 exp_stage.addressing,
81 name="foo",
82 params=["foo=3"],
83 force=True,
84 tmp_dir=not workspace,
85 )
86 exp = first(results)
87
88 fs = scm.get_fs(exp)
89 with fs.open("metrics.yaml", mode="r", encoding="utf-8") as fobj:
90 assert fobj.read().strip() == "foo: 3"
91
92
93@pytest.mark.skipif(os.name == "nt", reason="Not supported for Windows.")

Callers

nothing calls this directly

Calls 3

openMethod · 0.80
runMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected