Skip to content

Commit ba876c4

Browse files
authored
bpo-42934: use TracebackException(compact=True) in unittest.TestResult (GH-24221)
1 parent e56d54e commit ba876c4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Lib/unittest/result.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ def _exc_info_to_string(self, err, test):
183183
else:
184184
length = None
185185
tb_e = traceback.TracebackException(
186-
exctype, value, tb, limit=length, capture_locals=self.tb_locals)
186+
exctype, value, tb,
187+
limit=length, capture_locals=self.tb_locals, compact=True)
187188
msgLines = list(tb_e.format())
188189

189190
if self.buffer:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Use :class:`~traceback.TracebackException`'s new ``compact`` param in
2+
:class:`~unittest.TestResult` to reduce time and memory consumed by
3+
traceback formatting.

0 commit comments

Comments
 (0)