r47356 - Expand docstring and assertions.
mithrandi-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org Fri, 6 May 2016 21:16:06 -0600 (MDT)
| Newsgroups | gmane.comp.python.twisted.commits |
|---|---|
| Message-ID | <[email protected]> |
Author: mithrandi
Date: Fri May 6 21:15:58 2016
New Revision: 47356
Modified:
branches/stdlib-exception-logging-8316/twisted/logger/test/test_stdlib.py
Log:
Expand docstring and assertions.
Modified: branches/stdlib-exception-logging-8316/twisted/logger/test/test_stdlib.py
==============================================================================
--- branches/stdlib-exception-logging-8316/twisted/logger/test/test_stdlib.py (original)
+++ branches/stdlib-exception-logging-8316/twisted/logger/test/test_stdlib.py Fri May 6 21:15:58 2016
@@ -188,28 +188,38 @@
"""
An event with a failure logs the failure details as well.
"""
- try:
+ def failing_func():
1 / 0
+ try:
+ failing_func()
except ZeroDivisionError:
failure = Failure()
event = dict(log_format='Hi mom', who='me', log_failure=failure)
records, output = self.logEvent(event)
self.assertEqual(len(records), 1)
+ self.assertIn(u'Hi mom', output)
+ self.assertIn(u'in failing_func', output)
self.assertIn(u'ZeroDivisionError', output)
def test_cleanedFailure(self):
"""
- An event with a cleaned failure logs the failure details as well.
+ A cleaned Failure object has a fake traceback object; make sure that
+ logging such a failure still results in the exception details being
+ logged.
"""
- try:
+ def failing_func():
1 / 0
+ try:
+ failing_func()
except ZeroDivisionError:
failure = Failure()
failure.cleanFailure()
event = dict(log_format='Hi mom', who='me', log_failure=failure)
records, output = self.logEvent(event)
self.assertEqual(len(records), 1)
+ self.assertIn(u'Hi mom', output)
+ self.assertIn(u'in failing_func', output)
self.assertIn(u'ZeroDivisionError', output)