summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/result.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/unittest/result.py')
-rw-r--r--Lib/unittest/result.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/unittest/result.py b/Lib/unittest/result.py
index 8e0a643..a18f11b 100644
--- a/Lib/unittest/result.py
+++ b/Lib/unittest/result.py
@@ -45,6 +45,7 @@ class TestResult(object):
self.unexpectedSuccesses = []
self.shouldStop = False
self.buffer = False
+ self.tb_locals = False
self._stdout_buffer = None
self._stderr_buffer = None
self._original_stdout = sys.stdout
@@ -179,9 +180,11 @@ class TestResult(object):
if exctype is test.failureException:
# Skip assert*() traceback levels
length = self._count_relevant_tb_levels(tb)
- msgLines = traceback.format_exception(exctype, value, tb, length)
else:
- msgLines = traceback.format_exception(exctype, value, tb)
+ length = None
+ tb_e = traceback.TracebackException(
+ exctype, value, tb, limit=length, capture_locals=self.tb_locals)
+ msgLines = list(tb_e.format())
if self.buffer:
output = sys.stdout.getvalue()