don't unprotect outs if not cached (#9838)

* don't unprotect outs if not cached

* fix tests
This commit is contained in:
Dave Berenbaum
2023-08-11 18:12:25 +03:00
committed by GitHub
parent a051b8b60f
commit 79cc28501b
2 changed files with 25 additions and 1 deletions
+24
View File
@@ -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()