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

Function test_move_missing_file

tests/func/test_move.py:30–45  ·  view source on GitHub ↗
(tmp_dir, dvc, scm, caplog)

Source from the content-addressed store, hash-verified

28
29
30def test_move_missing_file(tmp_dir, dvc, scm, caplog):
31 tmp_dir.dvc_gen("foo", "foo")
32 (tmp_dir / "foo").unlink()
33 contents = (tmp_dir / "foo.dvc").parse()
34 dvc.move("foo", "bar")
35
36 assert not (tmp_dir / "foo.dvc").exists()
37 # only the path should be changed in the dvc file
38 contents["outs"][0]["path"] = "bar"
39 assert contents == (tmp_dir / "bar.dvc").parse()
40
41 # file should not be checked out
42 assert not (tmp_dir / "foo").is_file()
43 assert not (tmp_dir / "bar").is_file()
44 # should only have the new path in the .gitignore, and only once
45 assert (tmp_dir / ".gitignore").read_text().splitlines() == ["/bar"]
46
47
48def test_move_directory(tmp_dir, dvc):

Callers

nothing calls this directly

Calls 7

dvc_genMethod · 0.80
unlinkMethod · 0.80
parseMethod · 0.80
moveMethod · 0.80
is_fileMethod · 0.80
existsMethod · 0.45
read_textMethod · 0.45

Tested by

no test coverage detected