| 28 | |
| 29 | |
| 30 | def 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 | |
| 48 | def test_move_directory(tmp_dir, dvc): |