]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-36903: Fix ResourceWarning in test_logging (GH-13283) (GH-13285)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 13 May 2019 15:39:50 +0000 (08:39 -0700)
committerVictor Stinner <vstinner@redhat.com>
Mon, 13 May 2019 15:39:50 +0000 (17:39 +0200)
(cherry picked from commit 2c10538d11fa9be9a1a9f21605861e10ec4fa207)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
Lib/test/test_logging.py

index 42746d40d2cd278e0b31fea0237dbce010476163..14277369be477f44a4dab2ad94aa9dd23f1390c6 100644 (file)
@@ -689,6 +689,7 @@ class HandlerTest(BaseTest):
 
         self.assertEqual(len(logging._handlers), 0)
         refed_h = _OurHandler()
+        self.addCleanup(refed_h.sub_handler.stream.close)
         refed_h.name = 'because we need at least one for this test'
         self.assertGreater(len(logging._handlers), 0)
         self.assertGreater(len(logging._at_fork_reinit_lock_weakset), 1)