Skip to content

Commit 21540ad

Browse files
committed
bug fixes in persistentcache location init
1 parent 1ec24bb commit 21540ad

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pydra/utils/hash.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def location_converter(path: ty.Union[Path, str, None]) -> Path:
6060
if path is None:
6161
path = PersistentCache.location_default()
6262
path = Path(path)
63-
path.mkdir(parents=True, exist_ok=True)
63+
if not path.exists():
64+
path.mkdir(parents=True)
6465
return path
6566

6667

pydra/utils/tests/test_hash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from hashlib import blake2b
44
from pathlib import Path
55
import time
6-
6+
from unittest import mock
77
import attrs
88
import pytest
99
import typing as ty
@@ -336,7 +336,7 @@ def test_persistent_hash_cache(cache_path, text_file):
336336

337337
# Test that changes to the text file result in new hash
338338
time.sleep(2) # Need to ensure that the mtimes will be different
339-
text_file_path.write_text("bar")
339+
text_file.fspath.write_text("bar")
340340
assert hash_object(text_file, persistent_cache=cache_path) != modified_hash
341341
assert len(list(cache_path.iterdir())) == 2
342342

0 commit comments

Comments
 (0)