summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/unittest/result.py4
-rw-r--r--Lib/unittest/test/test_result.py16
2 files changed, 16 insertions, 4 deletions
diff --git a/Lib/unittest/result.py b/Lib/unittest/result.py
index 92b1f91..1dbd04c 100644
--- a/Lib/unittest/result.py
+++ b/Lib/unittest/result.py
@@ -153,9 +153,7 @@ class TestResult(object):
length = self._count_relevant_tb_levels(tb)
msgLines = traceback.format_exception(exctype, value, tb, length)
else:
- chain = exctype is not None
- msgLines = traceback.format_exception(exctype, value, tb,
- chain=chain)
+ msgLines = traceback.format_exception(exctype, value, tb)
if self.buffer:
output = sys.stdout.getvalue()
diff --git a/Lib/unittest/test/test_result.py b/Lib/unittest/test/test_result.py
index c703032..64798a1 100644
--- a/Lib/unittest/test/test_result.py
+++ b/Lib/unittest/test/test_result.py
@@ -4,6 +4,7 @@ import textwrap
from test import support
+import traceback
import unittest
@@ -361,6 +362,15 @@ class Test_OldTestResult(unittest.TestCase):
runner.run(Test('testFoo'))
+class MockTraceback(object):
+ @staticmethod
+ def format_exception(*_):
+ return ['A traceback']
+
+def restore_traceback():
+ unittest.result.traceback = traceback
+
+
class TestOutputBuffering(unittest.TestCase):
def setUp(self):
@@ -441,6 +451,9 @@ class TestOutputBuffering(unittest.TestCase):
return result
def testBufferOutputAddErrorOrFailure(self):
+ unittest.result.traceback = MockTraceback
+ self.addCleanup(restore_traceback)
+
for message_attr, add_attr, include_error in [
('errors', 'addError', True),
('failures', 'addFailure', False),
@@ -476,7 +489,8 @@ class TestOutputBuffering(unittest.TestCase):
Stderr:
bar
""")
- expectedFullMessage = 'NoneType\n%s%s' % (expectedOutMessage, expectedErrMessage)
+
+ expectedFullMessage = 'A traceback%s%s' % (expectedOutMessage, expectedErrMessage)
self.assertIs(test, self)
self.assertEqual(result._original_stdout.getvalue(), expectedOutMessage)