Skip to content

Commit

Permalink
Merge pull request #3067 from pared/2896_cache
Browse files Browse the repository at this point in the history
cache: test: migrate to dir helpers
  • Loading branch information
efiop authored Jan 6, 2020
2 parents cf37fe2 + d2859a3 commit e5ac017
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/func/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,16 @@ def test(self):
"protected,dir_mode,file_mode",
[(False, 0o775, 0o664), (True, 0o775, 0o444)],
)
def test_shared_cache(repo_dir, dvc_repo, protected, dir_mode, file_mode):
assert main(["config", "cache.shared", "group"]) == 0
def test_shared_cache(tmp_dir, dvc, protected, dir_mode, file_mode):
dvc.config.set("cache", "shared", "group")
dvc.config.set("cache", "protected", str(protected))
dvc.cache = Cache(dvc)

if protected:
assert main(["config", "cache.protected", "true"]) == 0
tmp_dir.dvc_gen(
{"file": "file content", "dir": {"file2": "file 2 " "content"}}
)

assert main(["add", repo_dir.FOO]) == 0
assert main(["add", repo_dir.DATA_DIR]) == 0

for root, dnames, fnames in os.walk(dvc_repo.cache.local.cache_dir):
for root, dnames, fnames in os.walk(dvc.cache.local.cache_dir):
for dname in dnames:
path = os.path.join(root, dname)
assert stat.S_IMODE(os.stat(path).st_mode) == dir_mode
Expand Down

0 comments on commit e5ac017

Please sign in to comment.