(tmp_dir, dvc)
| 12 | |
| 13 | |
| 14 | def test_cache(tmp_dir, dvc): |
| 15 | cache1_md5 = "123" |
| 16 | cache2_md5 = "234" |
| 17 | cache1 = os.path.join(dvc.cache.local.path, cache1_md5[:2], cache1_md5[2:]) |
| 18 | cache2 = os.path.join(dvc.cache.local.path, cache2_md5[:2], cache2_md5[2:]) |
| 19 | tmp_dir.gen({cache1: "1", cache2: "2"}) |
| 20 | |
| 21 | assert os.path.exists(cache1) |
| 22 | assert os.path.exists(cache2) |
| 23 | |
| 24 | odb = CacheManager(dvc) |
| 25 | |
| 26 | md5_list = list(odb.local.all()) |
| 27 | assert len(md5_list) == 2 |
| 28 | assert cache1_md5 in md5_list |
| 29 | assert cache2_md5 in md5_list |
| 30 | |
| 31 | odb_cache1 = odb.local.oid_to_path(cache1_md5) |
| 32 | odb_cache2 = odb.local.oid_to_path(cache2_md5) |
| 33 | assert os.fspath(odb_cache1) == cache1 |
| 34 | assert os.fspath(odb_cache2) == cache2 |
| 35 | |
| 36 | |
| 37 | def test_cache_load_bad_dir_cache(tmp_dir, dvc): |
nothing calls this directly
no test coverage detected