[Python-checkins] cpython: Attempt fix of #11557 by changing teardown logic.

vinay.sajip python-checkins at python.org
Wed Apr 20 11:58:14 CEST 2011


http://hg.python.org/cpython/rev/41dc66528c4e
changeset:   69465:41dc66528c4e
parent:      69463:e4e92d68ba3a
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Wed Apr 20 10:58:06 2011 +0100
summary:
  Attempt fix of #11557 by changing teardown logic.

files:
  Lib/test/test_logging.py |  13 +++++++++----
  1 files changed, 9 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -2414,15 +2414,20 @@
 
     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()
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list