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

Function test_diff_rename_folder

tests/func/test_diff.py:579–621  ·  view source on GitHub ↗
(tmp_dir, scm, dvc, commit_last)

Source from the content-addressed store, hash-verified

577
578@pytest.mark.parametrize("commit_last", [True, False])
579def test_diff_rename_folder(tmp_dir, scm, dvc, commit_last):
580 if commit_last:
581 last_commit_msg = "commit #2"
582 a_rev = "HEAD~1"
583 else:
584 last_commit_msg = None
585 a_rev = "HEAD"
586
587 tmp_dir.dvc_gen(
588 {"dir": {"file": "text1", "subdir": {"file2": "text2"}}},
589 commit="commit #1",
590 )
591 (tmp_dir / "dir").replace(tmp_dir / "dir2")
592 tmp_dir.dvc_add("dir2", commit=last_commit_msg)
593 assert dvc.diff(a_rev) == {
594 "added": [],
595 "deleted": [],
596 "modified": [],
597 "renamed": [
598 {
599 "path": {
600 "old": os.path.join("dir", ""),
601 "new": os.path.join("dir2", ""),
602 },
603 "hash": "cb58ee07cb01044db229e4d6121a0dfc.dir",
604 },
605 {
606 "path": {
607 "old": os.path.join("dir", "file"),
608 "new": os.path.join("dir2", "file"),
609 },
610 "hash": "cef7ccd89dacf1ced6f5ec91d759953f",
611 },
612 {
613 "path": {
614 "old": os.path.join("dir", "subdir", "file2"),
615 "new": os.path.join("dir2", "subdir", "file2"),
616 },
617 "hash": "fe6123a759017e4a2af4a2d19961ed71",
618 },
619 ],
620 "not in cache": [],
621 }
622
623
624@pytest.mark.parametrize("commit_last", [True, False])

Callers

nothing calls this directly

Calls 5

dvc_genMethod · 0.80
dvc_addMethod · 0.80
joinMethod · 0.80
replaceMethod · 0.45
diffMethod · 0.45

Tested by

no test coverage detected