Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dvc/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,10 @@ def relative_update(self, inc: int = 1) -> None:
return added, False if added else modified

def remove(self, ignore_remove=False):
self.fs.remove(self.fs_path, recursive=True)
try:
self.fs.remove(self.fs_path, recursive=True)
except FileNotFoundError:
pass
if self.protocol != Schemes.LOCAL:
return

Expand Down
9 changes: 9 additions & 0 deletions tests/func/repro/test_repro.py
Original file line number Diff line number Diff line change
Expand Up @@ -1273,3 +1273,12 @@ def test_repro_missing_lock_info(tmp_dir, dvc, copy_script):

stages = dvc.reproduce(stage.addressing)
assert len(stages) == 1


def test_repro_rm_recursive(tmp_dir, dvc):
# check that dir output recursively removes files in the dir
tmp_dir.gen({"dir": {"foo": "foo"}})
dvc.stage.add(name="dir", cmd="mkdir dir", outs=["dir"])
dvc.reproduce()
assert (tmp_dir / "dir").exists()
assert not (tmp_dir / "dir" / "foo").exists()