Issue #10788: Changed test_logging setUp logic to provide more information.

This commit is contained in:
Vinay Sajip 2010-12-30 23:26:50 +00:00
parent 81f3d7bcd0
commit 7b0e86ef17
1 changed files with 6 additions and 2 deletions

View File

@ -90,8 +90,12 @@ class BaseTest(unittest.TestCase):
self.root_hdlr = logging.StreamHandler(self.stream)
self.root_formatter = logging.Formatter(self.log_format)
self.root_hdlr.setFormatter(self.root_formatter)
self.assertFalse(self.logger1.hasHandlers())
self.assertFalse(self.logger2.hasHandlers())
if self.logger1.hasHandlers():
hlist = self.logger1.handlers + self.root_logger.handlers
raise AssertionError('Unexpected handlers: %s' % hlist)
if self.logger2.hasHandlers():
hlist = self.logger2.handlers + self.root_logger.handlers
raise AssertionError('Unexpected handlers: %s' % hlist)
self.root_logger.addHandler(self.root_hdlr)
self.assertTrue(self.logger1.hasHandlers())
self.assertTrue(self.logger2.hasHandlers())