Skip to content

Commit 8ba4fe6

Browse files
committed
gh-153296: Fix flaky test_rollover_at_midnight on Windows
1 parent 21fafe9 commit 8ba4fe6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/test/test_logging.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6729,7 +6729,9 @@ def test_rollover_at_midnight(self, weekly=False):
67296729
# The creation time, used to compute the rollover time, cannot be
67306730
# changed, so the rollover cannot be forced by back-dating the file.
67316731
# Wait until the clock reaches a rollover time set one second ahead.
6732-
rollover = int(time.time()) + 1
6732+
stat = os.stat(self.fn)
6733+
file_time = int(min(getattr(stat, 'st_birthtime', stat.st_ctime), stat.st_mtime))
6734+
rollover = max(int(time.time()), file_time) + 1
67336735
atTime = datetime.datetime.fromtimestamp(rollover).time()
67346736
while time.time() < rollover:
67356737
time.sleep(rollover - time.time())

0 commit comments

Comments
 (0)