mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-05 23:09:32 +01:00
29 lines
855 B
Python
29 lines
855 B
Python
import pytest
|
|
|
|
from tests.func.test_repro_multistage import COPY_SCRIPT
|
|
|
|
|
|
# https://github.com/iterative/dvc/issues/4401
|
|
@pytest.mark.flaky(max_runs=3, min_passes=1)
|
|
def test_new_simple(tmp_dir, scm, dvc, mocker):
|
|
tmp_dir.gen("copy.py", COPY_SCRIPT)
|
|
tmp_dir.gen("params.yaml", "foo: 1")
|
|
stage = dvc.run(
|
|
cmd="python copy.py params.yaml metrics.yaml",
|
|
metrics_no_cache=["metrics.yaml"],
|
|
params=["foo"],
|
|
name="copy-file",
|
|
)
|
|
scm.add(["dvc.yaml", "dvc.lock", "copy.py", "params.yaml", "metrics.yaml"])
|
|
scm.commit("init")
|
|
|
|
tmp_dir.gen("params.yaml", "foo: 2")
|
|
|
|
new_mock = mocker.spy(dvc.experiments, "new")
|
|
dvc.reproduce(stage.addressing, experiment=True)
|
|
|
|
new_mock.assert_called_once()
|
|
assert (
|
|
tmp_dir / ".dvc" / "experiments" / "metrics.yaml"
|
|
).read_text() == "foo: 2"
|