]> granicus.if.org Git - python/commitdiff
Attempt fix of #11557 by changing teardown logic.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Wed, 20 Apr 2011 09:58:06 +0000 (10:58 +0100)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Wed, 20 Apr 2011 09:58:06 +0000 (10:58 +0100)
Lib/test/test_logging.py

index b2e3327fd56bdea0faeb67d48b9ad1b112231020..0a7d7d128e4c91282535df9a34cccd9cbd1369a0 100644 (file)
@@ -2414,15 +2414,20 @@ class BasicConfigTest(unittest.TestCase):
 
     def setUp(self):
         super(BasicConfigTest, self).setUp()
-        handlers = logging.root.handlers
-        self.addCleanup(lambda: setattr(logging.root, 'handlers', handlers))
+        self.handlers = logging.root.handlers
+        self.addCleanup(self.cleanup)
         logging.root.handlers = []
 
     def tearDown(self):
-        logging.shutdown()
+        for h in logging.root.handlers[:]:
+            logging.root.removeHandler(h)
+            h.close()
         super(BasicConfigTest, self).tearDown()
 
-    @unittest.skipIf(True, "test disabled, issue #11557")
+    def cleanup(self):
+        setattr(logging.root, 'handlers', self.handlers)
+
+    #@unittest.skipIf(True, "test disabled, issue #11557")
     def test_no_kwargs(self):
         logging.basicConfig()