Issue 7815. __unittest in module globals trims frames from reported stacktraces in unittest.

This commit is contained in:
Michael Foord 2010-03-22 00:06:30 +00:00
parent bb9d726357
commit b1aa30f94d
10 changed files with 32 additions and 5 deletions

View file

@ -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__'):