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

Function test_cmd_cache_relative_path

tests/func/test_odb.py:131–150  ·  view source on GitHub ↗
(tmp_dir, scm, dvc, make_tmp_dir)

Source from the content-addressed store, hash-verified

129
130
131def test_cmd_cache_relative_path(tmp_dir, scm, dvc, make_tmp_dir):
132 cache_dir = make_tmp_dir("cache")
133 dname = relpath(cache_dir)
134 ret = main(["cache", "dir", dname])
135 assert ret == 0
136
137 dvc.config.load()
138 dvc.cache = CacheManager(dvc)
139
140 # NOTE: we are in the repo's root and config is in .dvc/, so
141 # dir path written to config should be just one level above.
142 rel = os.path.join("..", dname)
143 config = configobj.ConfigObj(dvc.config.files["repo"])
144 assert config["cache"]["dir"] == rel.replace("\\", "/")
145
146 tmp_dir.dvc_gen({"foo": "foo"})
147
148 assert os.path.exists(
149 os.path.join(cache_dir, "files", "md5", "ac", "bd18db4cc2f85cedef654fccc4a4d8")
150 )
151
152
153def test_default_cache_type(dvc):

Callers

nothing calls this directly

Calls 9

relpathFunction · 0.90
mainFunction · 0.90
CacheManagerClass · 0.90
make_tmp_dirFunction · 0.85
joinMethod · 0.80
dvc_genMethod · 0.80
loadMethod · 0.45
replaceMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected