diff --git a/tests/func/repro/test_repro.py b/tests/func/repro/test_repro.py index 551e70527c..5f68c1e60f 100644 --- a/tests/func/repro/test_repro.py +++ b/tests/func/repro/test_repro.py @@ -1366,3 +1366,27 @@ def test_repro_ignore_errors(mocker, tmp_dir, dvc, copy_script): [bar_call, stage1_call, foo_call, stage2_call], [foo_call, bar_call, stage1_call, stage2_call], ) + + +@pytest.mark.parametrize("persist", [True, False]) +def test_repro_external_outputs(tmp_dir, dvc, local_workspace, persist): + local_workspace.gen("foo", "foo") + foo_path = str(local_workspace / "foo") + bar_path = str(local_workspace / "bar") + outs = {"outs_no_cache": [bar_path]} + if persist: + outs = {"outs_persist_no_cache": [bar_path]} + dvc.run( + name="mystage", + cmd=f"cp {foo_path} {bar_path}", + deps=[foo_path], + no_exec=True, + **outs, + ) + + dvc.reproduce() + dvc.reproduce(force=True) + + assert (local_workspace / "foo").read_text() == "foo" + assert (local_workspace / "bar").read_text() == "foo" + assert not (local_workspace / "cache").exists() diff --git a/tests/func/test_run.py b/tests/func/test_run.py index 1bde432655..50e5d598ea 100644 --- a/tests/func/test_run.py +++ b/tests/func/test_run.py @@ -520,22 +520,22 @@ def test_run_overwrite_preserves_meta_and_comment(tmp_dir, dvc, run_copy): assert (tmp_dir / PROJECT_FILE).read_text() == text.format(src="foo1", dest="bar1") -@pytest.mark.parametrize("persist", [True, False]) -def test_run_external_outputs(tmp_dir, dvc, local_workspace, persist): +def test_run_external_outputs( + tmp_dir, + dvc, + local_workspace, +): hash_name = "md5" foo_hash = "acbd18db4cc2f85cedef654fccc4a4d8" bar_hash = "37b51d194a7513e45b56f6524f2d51f2" local_workspace.gen("foo", "foo") - outs = {"outs_no_cache": ["remote://workspace/bar"]} - if persist: - outs = {"outs_persist_no_cache": ["remote://workspace/bar"]} dvc.run( name="mystage", cmd="mycmd", deps=["remote://workspace/foo"], + outs_no_cache=["remote://workspace/bar"], no_exec=True, - **outs, ) dvc_yaml = ( @@ -548,8 +548,6 @@ def test_run_external_outputs(tmp_dir, dvc, local_workspace, persist): " - remote://workspace/bar:\n" " cache: false\n" ) - if persist: - dvc_yaml += " persist: true\n" assert (tmp_dir / "dvc.yaml").read_text() == dvc_yaml assert not (tmp_dir / "dvc.lock").exists()