]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-115282: Fix direct invocation of `test_traceback.py` (#115283)
authorNikita Sobolev <mail@sobolevn.me>
Sun, 11 Feb 2024 16:07:08 +0000 (19:07 +0300)
committerGitHub <noreply@github.com>
Sun, 11 Feb 2024 16:07:08 +0000 (19:07 +0300)
Lib/test/test_traceback.py

index 372fc48bf81a6a3b066730d9a13b9bc9a2438e6a..dd9b1850adf086067e681a36004df15cee59893b 100644 (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.