Skip to content

Commit cc573c7

Browse files
authored
pythongh-115282: Fix direct invocation of test_traceback.py (python#115283)
1 parent 2939ad0 commit cc573c7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Lib/test/test_traceback.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3124,10 +3124,13 @@ def test_smoke_user_exception(self):
31243124
class MyException(Exception):
31253125
pass
31263126

3127-
self.do_test_smoke(
3128-
MyException('bad things happened'),
3129-
('test.test_traceback.TestTracebackException.'
3130-
'test_smoke_user_exception.<locals>.MyException'))
3127+
if __name__ == '__main__':
3128+
expected = ('TestTracebackException.'
3129+
'test_smoke_user_exception.<locals>.MyException')
3130+
else:
3131+
expected = ('test.test_traceback.TestTracebackException.'
3132+
'test_smoke_user_exception.<locals>.MyException')
3133+
self.do_test_smoke(MyException('bad things happened'), expected)
31313134

31323135
def test_from_exception(self):
31333136
# Check all the parameters are accepted.

0 commit comments

Comments
 (0)