FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-84649: Fix unstable test_rollover_at_midnight by serhiy-storchaka · Pull Request #151813 · python/cpython · GitHub

Repository navigation

gh-84649: Fix unstable test_rollover_at_midnight - #151813

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:fix-test-rollover-at-midnight
Jun 20, 2026
Merged

serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:fix-test-rollover-at-midnight

Conversation

Copy link
Copy Markdown
Member

The test test_rollover_at_midnight (and test_rollover_at_weekday) became unstable on Windows after gh-84649, which made TimedRotatingFileHandler base the rollover time on the minimum of the file creation and modification times. The test forced a rollover by back-dating the modification time, but the creation time cannot be changed, so the file no longer reliably looked old enough and the rollover did not happen.

Instead of moving the file's timestamps into the past, set the rollover time (atTime) one second after the file creation time and wait until the clock reaches it. This keeps the one-second offset that exercises the atTime rounding in computeRollover() while no longer depending on the ability to change the file times.

The test forced a rollover by back-dating the file modification time, but
the rollover time is now based also on the creation time, which cannot be
changed.  Instead, set the rollover time one second after the file
creation time and wait until the clock reaches it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
serhiy-storchaka requested a review from vsajip as a code owner June 20, 2026 17:45
bedevere-app Bot added tests Tests in the Lib/test dir awaiting core review labels Jun 20, 2026
serhiy-storchaka enabled auto-merge (squash) June 20, 2026 17:58
serhiy-storchaka merged commit 1b9fe5c into python:main Jun 20, 2026
177 checks passed
serhiy-storchaka deleted the fix-test-rollover-at-midnight branch June 20, 2026 22:26
pyctrl pushed a commit to pyctrl/cpython that referenced this pull request Jul 5, 2026
The test forced a rollover by back-dating the file modification time, but
the rollover time is now based also on the creation time, which cannot be
changed.  Instead, set the rollover time one second after the file
creation time and wait until the clock reaches it.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL