Skip to content

Commit

Permalink
added another sleep to trigger atime change
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Feb 24, 2024
1 parent f1ded7a commit bb11067
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pydra/utils/tests/test_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,13 @@ def test_persistent_hash_cache(cache_path, text_file):
assert len(list(cache_path.iterdir())) == 2


def test_persistent_hash_cache_cleanup(cache_path, text_file):
def test_persistent_hash_cache_cleanup1(cache_path, text_file):
with mock.patch.dict(
os.environ,
{"PYDRA_HASH_CACHE": str(cache_path), "PYDRA_HASH_CACHE_CLEANUP_PERIOD": "-1"},
{
"PYDRA_HASH_CACHE": str(cache_path),
"PYDRA_HASH_CACHE_CLEANUP_PERIOD": "-100",
},
):
persistent_cache = PersistentCache()
hsh = hash_object(text_file, persistent_cache=persistent_cache)
Expand All @@ -353,10 +356,11 @@ def test_persistent_hash_cache_cleanup(cache_path, text_file):
assert len(list(cache_path.iterdir())) == 0


def test_persistent_hash_cache_badpath(cache_path, text_file):
persistent_cache = PersistentCache(cache_path, cleanup_period=-1)
def test_persistent_hash_cache_cleanup2(cache_path, text_file):
persistent_cache = PersistentCache(cache_path, cleanup_period=-100)
hsh = hash_object(text_file, persistent_cache=persistent_cache)
assert len(list(cache_path.iterdir())) == 1
time.sleep(2)
persistent_cache.clean_up()
assert len(list(cache_path.iterdir())) == 0

Expand Down

0 comments on commit bb11067

Please sign in to comment.