bpo-42934: use TracebackException(compact=True) in unittest.TestResult (GH-24221)

This commit is contained in:
Irit Katriel 2021-01-15 15:59:44 +00:00 committed by GitHub
parent e56d54e447
commit ba876c44a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -183,7 +183,8 @@ class TestResult(object):
else:
length = None
tb_e = traceback.TracebackException(
exctype, value, tb, limit=length, capture_locals=self.tb_locals)
exctype, value, tb,
limit=length, capture_locals=self.tb_locals, compact=True)
msgLines = list(tb_e.format())
if self.buffer:

View File

@ -0,0 +1,3 @@
Use :class:`~traceback.TracebackException`'s new ``compact`` param in
:class:`~unittest.TestResult` to reduce time and memory consumed by
traceback formatting.