mirror of
https://github.com/python/cpython.git
synced 2024-11-29 04:44:13 +08:00
Issue #10788: Changed test_logging setUp logic to provide more information.
This commit is contained in:
parent
81f3d7bcd0
commit
7b0e86ef17
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user