Skip to content

Commit ac8f80c

Browse files
gh-84649: Fix unstable test_rollover_based_on_st_birthtime_only (GH-150954)
1 parent c325012 commit ac8f80c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Lib/test/test_logging.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6617,6 +6617,7 @@ def test_rollover(self):
66176617

66186618
@unittest.skipUnless(support.has_st_birthtime,
66196619
"st_birthtime not available or supported by Python on this OS")
6620+
@support.requires_resource('walltime')
66206621
def test_rollover_based_on_st_birthtime_only(self):
66216622
def add_record(message: str) -> None:
66226623
fh = logging.handlers.TimedRotatingFileHandler(
@@ -6639,11 +6640,11 @@ def add_record(message: str) -> None:
66396640

66406641
# At this point, the log file should be rotated if the rotation
66416642
# is based on creation time but should be not if it's based on
6642-
# creation time.
6643+
# modification time.
66436644
found = False
66446645
now = datetime.datetime.now()
66456646
GO_BACK = 5 # seconds
6646-
for secs in range(GO_BACK):
6647+
for secs in range(GO_BACK + 1):
66476648
prev = now - datetime.timedelta(seconds=secs)
66486649
fn = self.fn + prev.strftime(".%Y-%m-%d_%H-%M-%S")
66496650
found = os.path.exists(fn)

0 commit comments

Comments
 (0)