| 74 | |
| 75 | |
| 76 | def test_shared_cache_dir(tmp_dir): |
| 77 | cache_dir = os.path.abspath(os.path.join(os.curdir, "cache")) |
| 78 | for d in ["dir1", "dir2"]: |
| 79 | os.mkdir(d) |
| 80 | with (tmp_dir / d).chdir(): |
| 81 | ret = main(["init", "--no-scm"]) |
| 82 | assert ret == 0 |
| 83 | |
| 84 | ret = main(["config", "cache.dir", cache_dir]) |
| 85 | assert ret == 0 |
| 86 | |
| 87 | assert not os.path.exists(os.path.join(".dvc", "cache")) |
| 88 | |
| 89 | (tmp_dir / d).gen({"common": "common", "unique": d}) |
| 90 | |
| 91 | ret = main(["add", "common", "unique"]) |
| 92 | assert ret == 0 |
| 93 | |
| 94 | assert not os.path.exists(os.path.join("dir1", ".dvc", "cache")) |
| 95 | assert not os.path.exists(os.path.join("dir2", ".dvc", "cache")) |
| 96 | assert os.path.exists( |
| 97 | os.path.join(cache_dir, "files", "md5", "dc", "f6c2fa538b445a3a095255c3641dfc") |
| 98 | ) |
| 99 | assert os.path.exists( |
| 100 | os.path.join(cache_dir, "files", "md5", "b4", "333c8cfa2ebba7ef20ec6c3265902b") |
| 101 | ) |
| 102 | assert os.path.exists( |
| 103 | os.path.join(cache_dir, "files", "md5", "9e", "fab2399c7c560b34de477b9aa0a465") |
| 104 | ) |
| 105 | |
| 106 | |
| 107 | def test_cache_link_type(tmp_dir, scm, dvc): |