https://github.com/python/cpython/commit/ac8f80ce7b93adf3a20c38b750118d73c5e316d1
commit: ac8f80ce7b93adf3a20c38b750118d73c5e316d1
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-06-05T12:41:51Z
summary:

gh-84649: Fix unstable test_rollover_based_on_st_birthtime_only (GH-150954)

files:
M Lib/test/test_logging.py

diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 31c052bfb56cd7..d4fa78acfd11de 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -6617,6 +6617,7 @@ def test_rollover(self):
 
     @unittest.skipUnless(support.has_st_birthtime,
         "st_birthtime not available or supported by Python on this OS")
+    @support.requires_resource('walltime')
     def test_rollover_based_on_st_birthtime_only(self):
         def add_record(message: str) -> None:
             fh = logging.handlers.TimedRotatingFileHandler(
@@ -6639,11 +6640,11 @@ def add_record(message: str) -> None:
 
         # At this point, the log file should be rotated if the rotation
         # is based on creation time but should be not if it's based on
-        # creation time.
+        # modification time.
         found = False
         now = datetime.datetime.now()
         GO_BACK = 5 # seconds
-        for secs in range(GO_BACK):
+        for secs in range(GO_BACK + 1):
             prev = now - datetime.timedelta(seconds=secs)
             fn = self.fn + prev.strftime(".%Y-%m-%d_%H-%M-%S")
             found = os.path.exists(fn)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to