https://github.com/python/cpython/commit/8b3dc69b007686df3e14eca8f73798b9d414ffb8
commit: 8b3dc69b007686df3e14eca8f73798b9d414ffb8
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: hugovk <[email protected]>
date: 2026-08-12T12:59:11Z
summary:

[3.15] gh-155423: Make BaseFileTest.tearDown() in test_logging robust 
(GH-155424) (#155441)

Co-authored-by: Serhiy Storchaka <[email protected]>

files:
M Lib/test/test_logging.py

diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 0828aae98dca16..10d2fffc421a1d 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -6358,11 +6358,12 @@ def setUp(self):
         self.rmfiles = []
 
     def tearDown(self):
-        for fn in self.rmfiles:
-            os.unlink(fn)
-        if os.path.exists(self.fn):
-            os.unlink(self.fn)
-        BaseTest.tearDown(self)
+        try:
+            for fn in self.rmfiles:
+                os_helper.unlink(fn)
+            os_helper.unlink(self.fn)
+        finally:
+            BaseTest.tearDown(self)
 
     def assertLogFile(self, filename):
         "Assert a log file is there and register it for deletion"

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to