]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42934: use TracebackException(compact=True) in unittest.TestResult (GH-24221)
authorIrit Katriel <iritkatriel@yahoo.com>
Fri, 15 Jan 2021 15:59:44 +0000 (15:59 +0000)
committerGitHub <noreply@github.com>
Fri, 15 Jan 2021 15:59:44 +0000 (07:59 -0800)
Lib/unittest/result.py
Misc/NEWS.d/next/Library/2021-01-15-11-48-00.bpo-42934.ILKoOI.rst [new file with mode: 0644]

index 111317b329a8521b5482a68d5f8962ba5772b6d9..ce7468e31481f071525ad60fe798f8c735819672 100644 (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:
diff --git a/Misc/NEWS.d/next/Library/2021-01-15-11-48-00.bpo-42934.ILKoOI.rst b/Misc/NEWS.d/next/Library/2021-01-15-11-48-00.bpo-42934.ILKoOI.rst
new file mode 100644 (file)
index 0000000..92f2402
--- /dev/null
@@ -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.