Skip to content

Commit

Permalink
delay on write check
Browse files Browse the repository at this point in the history
  • Loading branch information
pjbull committed Aug 22, 2024
1 parent e33b583 commit 757c392
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,19 +455,19 @@ def _wait_for_cloud_newer():
sleep(0.1) # at least a little different

@retry(
retry=retry_if_exception_type(OverwriteNewerLocalError),
retry=retry_if_exception_type((OverwriteNewerLocalError, AssertionError)),
wait=wait_random_exponential(multiplier=0.5, max=5),
stop=stop_after_attempt(10),
reraise=True,
)
def _retry_write_until_old_enough():
new_also_cloud.write_text("newer")
new_cloud_mod_time = new_also_cloud.stat().st_mtime
assert p.stat().st_mtime < new_cloud_mod_time # would raise if not set
return new_cloud_mod_time

_retry_write_until_old_enough()
new_cloud_mod_time = _retry_write_until_old_enough()

new_cloud_mod_time = new_also_cloud.stat().st_mtime

assert p.stat().st_mtime < new_cloud_mod_time # would raise if not set
p.copy(new_also_cloud)
assert new_also_cloud.stat().st_mtime >= new_cloud_mod_time

Expand Down

0 comments on commit 757c392

Please sign in to comment.