In LogTrapTestCase, leave everything alone rather than throwing an exception
if the logging config is not as expected.
This commit is contained in:
parent
551ea94d24
commit
221058e1cb
|
@ -246,6 +246,12 @@ class LogTrapTestCase(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
def run(self, result=None):
|
def run(self, result=None):
|
||||||
logger = logging.getLogger()
|
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:
|
if not logger.handlers:
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
self.assertEqual(len(logger.handlers), 1)
|
self.assertEqual(len(logger.handlers), 1)
|
||||||
|
|
Loading…
Reference in New Issue