gh-115282: Fix direct invocation of `test_traceback.py` (#115283)

This commit is contained in:
Nikita Sobolev 2024-02-11 19:07:08 +03:00 committed by GitHub
parent 2939ad02be
commit cc573c70b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -3124,10 +3124,13 @@ class TestTracebackException(unittest.TestCase):
class MyException(Exception):
pass
self.do_test_smoke(
MyException('bad things happened'),
('test.test_traceback.TestTracebackException.'
'test_smoke_user_exception.<locals>.MyException'))
if __name__ == '__main__':
expected = ('TestTracebackException.'
'test_smoke_user_exception.<locals>.MyException')
else:
expected = ('test.test_traceback.TestTracebackException.'
'test_smoke_user_exception.<locals>.MyException')
self.do_test_smoke(MyException('bad things happened'), expected)
def test_from_exception(self):
# Check all the parameters are accepted.