We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc46702 commit 9d97701Copy full SHA for 9d97701
1 file changed
Lib/test/test_logging.py
@@ -25,6 +25,7 @@
25
26
import codecs
27
import configparser
28
+import contextlib
29
import copy
30
import datetime
31
import pathlib
@@ -6387,10 +6388,8 @@ def other_side():
6387
6388
with threading_helper.start_threads([thread]):
6389
rh = logging.handlers.RotatingFileHandler(
6390
filename, encoding="utf-8", maxBytes=1)
- try:
6391
+ with contextlib.closing(rh):
6392
self.assertFalse(rh.shouldRollover(self.next_rec()))
- finally:
6393
- rh.close()
6394
6395
def test_should_rollover(self):
6396
with open(self.fn, 'wb') as f:
0 commit comments