]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
In LogTrapTestCase, leave everything alone rather than throwing an exception
authorBen Darnell <ben@bendarnell.com>
Mon, 16 Aug 2010 01:11:48 +0000 (18:11 -0700)
committerBen Darnell <ben@bendarnell.com>
Mon, 16 Aug 2010 01:11:48 +0000 (18:11 -0700)
if the logging config is not as expected.

tornado/testing.py

index ec25d5c969244895596baac6fcf936faa1a00a39..d39d3c63669a4d6f538293ece118ff6894a94430 100644 (file)
@@ -246,6 +246,12 @@ class LogTrapTestCase(unittest.TestCase):
     """
     def run(self, result=None):
         logger = logging.getLogger()
+        if len(logger.handlers) > 1:
+            # Multiple handlers have been defined.  It gets messy to handle
+            # this, especially since the handlers may have different
+            # formatters.  Just leave the logging alone in this case.
+            super(LogTrapTestCase, self).run(result)
+            return
         if not logger.handlers:
             logging.basicConfig()
         self.assertEqual(len(logger.handlers), 1)