]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-84649: Fix unstable test_rollover_based_on_st_birthtime_only (GH-150954)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 5 Jun 2026 12:41:51 +0000 (15:41 +0300)
committerGitHub <noreply@github.com>
Fri, 5 Jun 2026 12:41:51 +0000 (12:41 +0000)
Lib/test/test_logging.py

index 31c052bfb56cd7a4a35d8d3407963ddae682f4f4..d4fa78acfd11dee7b7835ccc64caa2a4009beb4c 100644 (file)
@@ -6617,6 +6617,7 @@ class TimedRotatingFileHandlerTest(BaseFileTest):
 
     @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 @@ class TimedRotatingFileHandlerTest(BaseFileTest):
 
         # 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)