MCPcopy Index your code
hub / github.com/treeverse/dvc / test_cache

Function test_cache

tests/func/test_odb.py:14–34  ·  view source on GitHub ↗
(tmp_dir, dvc)

Source from the content-addressed store, hash-verified

12
13
14def 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
37def test_cache_load_bad_dir_cache(tmp_dir, dvc):

Callers

nothing calls this directly

Calls 6

CacheManagerClass · 0.90
joinMethod · 0.80
oid_to_pathMethod · 0.80
genMethod · 0.45
existsMethod · 0.45
fspathMethod · 0.45

Tested by

no test coverage detected