summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2014-09-14 20:29:11 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2014-09-14 20:29:11 (GMT)
commit02a8f9e9acbe55efcbb7ebc3f821d3d2f9cca368 (patch)
tree842346c95aa2afded7bcf6a5a9171448c62b64c2 /Lib/test/test_logging.py
parent4ff91eb5e38517222ab4e65c1f9d0757c29cebc7 (diff)
downloadcpython-02a8f9e9acbe55efcbb7ebc3f821d3d2f9cca368.zip
cpython-02a8f9e9acbe55efcbb7ebc3f821d3d2f9cca368.tar.gz
cpython-02a8f9e9acbe55efcbb7ebc3f821d3d2f9cca368.tar.bz2
Closes #20537: logging methods now accept an exception instance as well as a Boolean value or exception tuple. Thanks to Yury Selivanov for the patch.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 070e636..7442381 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -3712,6 +3712,19 @@ class LoggerAdapterTest(unittest.TestCase):
self.assertEqual(record.exc_info,
(exc.__class__, exc, exc.__traceback__))
+ def test_exception_excinfo(self):
+ try:
+ 1 / 0
+ except ZeroDivisionError as e:
+ exc = e
+
+ self.adapter.exception('exc_info test', exc_info=exc)
+
+ self.assertEqual(len(self.recording.records), 1)
+ record = self.recording.records[0]
+ self.assertEqual(record.exc_info,
+ (exc.__class__, exc, exc.__traceback__))
+
def test_critical(self):
msg = 'critical test! %r'
self.adapter.critical(msg, self.recording)