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

Function test_shared_cache

tests/func/test_odb.py:159–181  ·  view source on GitHub ↗
(tmp_dir, dvc, group)

Source from the content-addressed store, hash-verified

157@pytest.mark.skipif(os.name == "nt", reason="Not supported for Windows.")
158@pytest.mark.parametrize("group", [False, True])
159def test_shared_cache(tmp_dir, dvc, group):
160 from dvc_data.hashfile.db.local import umask
161
162 if group:
163 with dvc.config.edit() as conf:
164 conf["cache"].update({"shared": "group"})
165 dvc.cache = CacheManager(dvc)
166 cache_dir = dvc.cache.local.path
167
168 assert not os.path.exists(cache_dir)
169
170 tmp_dir.dvc_gen({"file": "file content", "dir": {"file2": "file 2 content"}})
171
172 file_mode = oct(0o444)
173 dir_mode = oct(0o2775 if group else (0o777 & ~umask))
174 for root, dnames, fnames in os.walk(cache_dir):
175 for dname in dnames:
176 path = os.path.join(root, dname)
177 assert oct(stat.S_IMODE(os.stat(path).st_mode)) == dir_mode
178
179 for fname in fnames:
180 path = os.path.join(root, fname)
181 assert oct(stat.S_IMODE(os.stat(path).st_mode)) == file_mode

Callers

nothing calls this directly

Calls 7

CacheManagerClass · 0.90
editMethod · 0.80
dvc_genMethod · 0.80
walkMethod · 0.80
joinMethod · 0.80
updateMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected