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

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

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
5 changes: 3 additions & 2 deletions Lib/test/test_logging.py
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
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down
Loading

Back | FazBrowse Home | New Git URL