From cc573c70b7d5e169de2a6e4297068de407dc8d4d Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sun, 11 Feb 2024 19:07:08 +0300 Subject: gh-115282: Fix direct invocation of `test_traceback.py` (#115283) --- Lib/test/test_traceback.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 372fc48..dd9b185 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -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..MyException')) + if __name__ == '__main__': + expected = ('TestTracebackException.' + 'test_smoke_user_exception..MyException') + else: + expected = ('test.test_traceback.TestTracebackException.' + 'test_smoke_user_exception..MyException') + self.do_test_smoke(MyException('bad things happened'), expected) def test_from_exception(self): # Check all the parameters are accepted. -- cgit v0.12