Skip to content

Commit d2859a3

Browse files
committed
cache: test: migrate to dir helpers
1 parent 8041d70 commit d2859a3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/func/test_cache.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,16 @@ def test(self):
188188
"protected,dir_mode,file_mode",
189189
[(False, 0o775, 0o664), (True, 0o775, 0o444)],
190190
)
191-
def test_shared_cache(repo_dir, dvc_repo, protected, dir_mode, file_mode):
192-
assert main(["config", "cache.shared", "group"]) == 0
191+
def test_shared_cache(tmp_dir, dvc, protected, dir_mode, file_mode):
192+
dvc.config.set("cache", "shared", "group")
193+
dvc.config.set("cache", "protected", str(protected))
194+
dvc.cache = Cache(dvc)
193195

194-
if protected:
195-
assert main(["config", "cache.protected", "true"]) == 0
196+
tmp_dir.dvc_gen(
197+
{"file": "file content", "dir": {"file2": "file 2 " "content"}}
198+
)
196199

197-
assert main(["add", repo_dir.FOO]) == 0
198-
assert main(["add", repo_dir.DATA_DIR]) == 0
199-
200-
for root, dnames, fnames in os.walk(dvc_repo.cache.local.cache_dir):
200+
for root, dnames, fnames in os.walk(dvc.cache.local.cache_dir):
201201
for dname in dnames:
202202
path = os.path.join(root, dname)
203203
assert stat.S_IMODE(os.stat(path).st_mode) == dir_mode

0 commit comments

Comments
 (0)