| 27 | pytest.skip() |
| 28 | |
| 29 | def test_import_dir(self, tmp_dir, dvc, workspace, stage_md5, dir_md5): |
| 30 | from dvc.cachemgr import CacheManager |
| 31 | |
| 32 | workspace.gen({"dir": {"file": "file", "subdir": {"subfile": "subfile"}}}) |
| 33 | |
| 34 | # remove external cache to make sure that we don't need it |
| 35 | # to import dirs |
| 36 | with dvc.config.edit() as conf: |
| 37 | del conf["cache"] |
| 38 | dvc.cache = CacheManager(dvc) |
| 39 | |
| 40 | assert not (tmp_dir / "dir").exists() # sanity check |
| 41 | dvc.imp_url("remote://workspace/dir") |
| 42 | assert set(os.listdir(tmp_dir / "dir")) == {"file", "subdir"} |
| 43 | assert (tmp_dir / "dir" / "file").read_text() == "file" |
| 44 | assert list(os.listdir(tmp_dir / "dir" / "subdir")) == ["subfile"] |
| 45 | assert (tmp_dir / "dir" / "subdir" / "subfile").read_text() == "subfile" |
| 46 | |
| 47 | assert dvc.status() == {} |
| 48 | |
| 49 | if stage_md5 is not None and dir_md5 is not None: |
| 50 | assert (tmp_dir / "dir.dvc").read_text() == ( |
| 51 | f"md5: {stage_md5}\n" |
| 52 | "frozen: true\n" |
| 53 | "deps:\n" |
| 54 | f"- md5: {dir_md5}\n" |
| 55 | " size: 11\n" |
| 56 | " nfiles: 2\n" |
| 57 | " hash: md5\n" |
| 58 | " path: remote://workspace/dir\n" |
| 59 | "outs:\n" |
| 60 | "- md5: b6dcab6ccd17ca0a8bf4a215a37d14cc.dir\n" |
| 61 | " size: 11\n" |
| 62 | " nfiles: 2\n" |
| 63 | " hash: md5\n" |
| 64 | " path: dir\n" |
| 65 | ) |
| 66 | |
| 67 | @pytest.fixture |
| 68 | def is_object_storage(self): |