Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use contextlib.closing.
  • Loading branch information
serhiy-storchaka committed Dec 30, 2025
commit 9d97701beaf38b66ae4ca20558dbbcc457c543be
5 changes: 2 additions & 3 deletions Lib/test/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import codecs
import configparser
import contextlib
import copy
import datetime
import pathlib
Expand Down Expand Up @@ -6387,10 +6388,8 @@ def other_side():
with threading_helper.start_threads([thread]):
rh = logging.handlers.RotatingFileHandler(
filename, encoding="utf-8", maxBytes=1)
try:
with contextlib.closing(rh):
self.assertFalse(rh.shouldRollover(self.next_rec()))
finally:
rh.close()

def test_should_rollover(self):
with open(self.fn, 'wb') as f:
Expand Down