summaryrefslogtreecommitdiff
path: root/unit_tests
diff options
context:
space:
mode:
authorAdam Chainz <adam@adamj.eu>2015-09-04 15:05:50 +0100
committerAdam Chainz <adam@adamj.eu>2015-09-04 15:12:15 +0100
commit059e4412468bce0211e10ae8ed275122acd758b1 (patch)
tree403d39cc1ee3fdc32302dad70d08bf09c141f405 /unit_tests
parent716d822d43db30195f795daa9fd71d54e682ec0c (diff)
downloadnose-059e4412468bce0211e10ae8ed275122acd758b1.tar.gz
Fix logcapture plugin to capture output from non-propagating loggers, and to not output 'no handlers could be found' message
Diffstat (limited to 'unit_tests')
-rw-r--r--unit_tests/test_logcapture_plugin.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/unit_tests/test_logcapture_plugin.py b/unit_tests/test_logcapture_plugin.py
index 63aa651..1f2d50f 100644
--- a/unit_tests/test_logcapture_plugin.py
+++ b/unit_tests/test_logcapture_plugin.py
@@ -255,3 +255,21 @@ class TestLogCapturePlugin(object):
assert msg in ev
else:
assert msg.encode('utf-8') in ev
+
+ def test_non_propagating_loggers_handled(self):
+ c = LogCapture()
+ parser = OptionParser()
+ c.addOptions(parser, {})
+ options, args = parser.parse_args([])
+ c.configure(options, Config())
+
+ logger = logging.getLogger('foo.yes')
+ logger.propagate = False
+
+ c.start()
+ logger.debug("test message")
+ c.end()
+
+ records = c.formatLogRecords()
+ eq_(1, len(records))
+ assert records[0].startswith('foo.yes:'), records[0]