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

vinay.sajip python-checkins at python.org
Wed Apr 20 12:51:05 CEST 2011


http://hg.python.org/cpython/rev/31bb4788aa1c
changeset:   69467:31bb4788aa1c
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Wed Apr 20 11:50:56 2011 +0100
summary:
  Attempt fix of #11557 by changing setup/teardown logic.

files:
  Lib/test/test_logging.py |  7 ++++++-
  1 files changed, 6 insertions(+), 1 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
@@ -2410,11 +2410,13 @@
 
 class BasicConfigTest(unittest.TestCase):
 
-    """Tets suite for logging.basicConfig."""
+    """Test suite for logging.basicConfig."""
 
     def setUp(self):
         super(BasicConfigTest, self).setUp()
         self.handlers = logging.root.handlers
+        self.saved_handlers = logging._handlers.copy()
+        self.saved_handler_list = logging._handlerList[:]
         self.addCleanup(self.cleanup)
         logging.root.handlers = []
 
@@ -2426,6 +2428,9 @@
 
     def cleanup(self):
         setattr(logging.root, 'handlers', self.handlers)
+        logging._handlers.clear()
+        logging._handlers.update(self.saved_handlers)
+        logging._handlerList[:] = self.saved_handler_list
 
     #@unittest.skipIf(True, "test disabled, issue #11557")
     def test_no_kwargs(self):

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


More information about the Python-checkins mailing list