From 7b0e86ef176ac076bf21698a11afaefa871483e2 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Thu, 30 Dec 2010 23:26:50 +0000 Subject: Issue #10788: Changed test_logging setUp logic to provide more information. --- Lib/test/test_logging.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 8c8a5e7..7c32020 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -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()) -- cgit v0.12