@@ -341,10 +341,13 @@ def test_persistent_hash_cache(cache_path, text_file):
341
341
assert len (list (cache_path .iterdir ())) == 2
342
342
343
343
344
- def test_persistent_hash_cache_cleanup (cache_path , text_file ):
344
+ def test_persistent_hash_cache_cleanup1 (cache_path , text_file ):
345
345
with mock .patch .dict (
346
346
os .environ ,
347
- {"PYDRA_HASH_CACHE" : str (cache_path ), "PYDRA_HASH_CACHE_CLEANUP_PERIOD" : "-1" },
347
+ {
348
+ "PYDRA_HASH_CACHE" : str (cache_path ),
349
+ "PYDRA_HASH_CACHE_CLEANUP_PERIOD" : "-100" ,
350
+ },
348
351
):
349
352
persistent_cache = PersistentCache ()
350
353
hsh = hash_object (text_file , persistent_cache = persistent_cache )
@@ -353,10 +356,11 @@ def test_persistent_hash_cache_cleanup(cache_path, text_file):
353
356
assert len (list (cache_path .iterdir ())) == 0
354
357
355
358
356
- def test_persistent_hash_cache_badpath (cache_path , text_file ):
357
- persistent_cache = PersistentCache (cache_path , cleanup_period = - 1 )
359
+ def test_persistent_hash_cache_cleanup2 (cache_path , text_file ):
360
+ persistent_cache = PersistentCache (cache_path , cleanup_period = - 100 )
358
361
hsh = hash_object (text_file , persistent_cache = persistent_cache )
359
362
assert len (list (cache_path .iterdir ())) == 1
363
+ time .sleep (2 )
360
364
persistent_cache .clean_up ()
361
365
assert len (list (cache_path .iterdir ())) == 0
362
366
0 commit comments