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

Function test_remove

tests/func/test_remove.py:15–33  ·  view source on GitHub ↗
(tmp_dir, scm, dvc, run_copy, remove_outs)

Source from the content-addressed store, hash-verified

13
14@pytest.mark.parametrize("remove_outs", [True, False])
15def test_remove(tmp_dir, scm, dvc, run_copy, remove_outs):
16 (stage1,) = tmp_dir.dvc_gen("foo", "foo")
17 stage2 = run_copy("foo", "bar", name="copy-foo-bar")
18 stage3 = run_copy("bar", "foobar", name="copy-bar-foobar")
19
20 assert "/foo" in get_gitignore_content()
21 assert "/bar" in get_gitignore_content()
22 assert "/foobar" in get_gitignore_content()
23
24 for stage in [stage1, stage2, stage3]:
25 dvc.remove(stage.addressing, outs=remove_outs)
26 out_exists = (out.exists for out in stage.outs)
27 assert stage not in dvc.index.stages
28 if remove_outs:
29 assert not any(out_exists)
30 else:
31 assert all(out_exists)
32
33 assert not (tmp_dir / ".gitignore").exists()
34
35
36def test_remove_file_target(tmp_dir, dvc):

Callers

nothing calls this directly

Calls 5

get_gitignore_contentFunction · 0.90
run_copyFunction · 0.85
dvc_genMethod · 0.80
removeMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected