Skip to content

Commit

Permalink
Account for possible low-resolution timer in file time tests
Browse files Browse the repository at this point in the history
- see #608
  • Loading branch information
mrbean-bremen committed Jun 5, 2021
1 parent 28d3089 commit 4bf5a4a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyfakefs/tests/fake_stat_time_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def setUp(self):
def stat_time(self, path):
stat = self.os.stat(path)
# sleep a bit so in the next call the time has changed
time.sleep(self.sleep_time)
current_time = time.time()
new_time = current_time
while new_time == current_time:
time.sleep(self.sleep_time)
new_time = time.time()
return FileTime(st_ctime=stat.st_ctime,
st_atime=stat.st_atime,
st_mtime=stat.st_mtime)
Expand Down

0 comments on commit 4bf5a4a

Please sign in to comment.