mirror of
https://github.com/python/cpython.git
synced 2025-09-13 12:17:24 +00:00
Issue 7815. __unittest in module globals trims frames from reported stacktraces in unittest.
This commit is contained in:
parent
bb9d726357
commit
b1aa30f94d
10 changed files with 32 additions and 5 deletions
|
@ -2084,6 +2084,16 @@ class Test_TestResult(TestCase):
|
|||
'Tests getDescription() for a method with a longer '
|
||||
'docstring.'))
|
||||
|
||||
def testStackFrameTrimming(self):
|
||||
class Frame(object):
|
||||
class tb_frame(object):
|
||||
f_globals = {}
|
||||
result = unittest.TestResult()
|
||||
self.assertFalse(result._is_relevant_tb_level(Frame))
|
||||
|
||||
Frame.tb_frame.f_globals['__unittest'] = True
|
||||
self.assertTrue(result._is_relevant_tb_level(Frame))
|
||||
|
||||
classDict = dict(unittest.TestResult.__dict__)
|
||||
for m in ('addSkip', 'addExpectedFailure', 'addUnexpectedSuccess',
|
||||
'__init__'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue