◐ Shell
clean mode source ↗

bpo-46425: fix direct invocation of `test_traceback` by sobolevn · Pull Request #30746 · python/cpython

Before this change when trying to run this module as ./python.exe ./Lib/test/test_traceback.py (as it is intended via uniitest.main() call here:

» ./python.exe ./Lib/test/test_traceback.py
.....F.........F.............................F.........F.........................................................................................
======================================================================
FAIL: test_exception_bad__str__ (__main__.CExcReportingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/./Lib/test/test_traceback.py", line 1353, in test_exception_bad__str__
    self.assertEqual(err, f"{str_name}: {str_value}\n")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'BaseExceptionReportingTests.test_exceptio[47 chars]d>\n' != '__main__.BaseExceptionReportingTests.test[56 chars]d>\n'
- BaseExceptionReportingTests.test_exception_bad__str__.<locals>.X: <exception str() failed>
+ __main__.BaseExceptionReportingTests.test_exception_bad__str__.<locals>.X: <exception str() failed>
? +++++++++


======================================================================
FAIL: test_exception_qualname (__main__.CExcReportingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/./Lib/test/test_traceback.py", line 1316, in test_exception_qualname
    self.assertEqual(exp, err)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '__main__.BaseExceptionReportingTests.test[40 chars] X\n' != 'BaseExceptionReportingTests.test_exceptio[31 chars] X\n'
- __main__.BaseExceptionReportingTests.test_exception_qualname.<locals>.A.B.X: I am X
? ---------
+ BaseExceptionReportingTests.test_exception_qualname.<locals>.A.B.X: I am X


======================================================================
FAIL: test_exception_bad__str__ (__main__.PyExcReportingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/./Lib/test/test_traceback.py", line 1353, in test_exception_bad__str__
    self.assertEqual(err, f"{str_name}: {str_value}\n")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'BaseExceptionReportingTests.test_exceptio[47 chars]d>\n' != '__main__.BaseExceptionReportingTests.test[56 chars]d>\n'
- BaseExceptionReportingTests.test_exception_bad__str__.<locals>.X: <exception str() failed>
+ __main__.BaseExceptionReportingTests.test_exception_bad__str__.<locals>.X: <exception str() failed>
? +++++++++


======================================================================
FAIL: test_exception_qualname (__main__.PyExcReportingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/./Lib/test/test_traceback.py", line 1316, in test_exception_qualname
    self.assertEqual(exp, err)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '__main__.BaseExceptionReportingTests.test[40 chars] X\n' != 'BaseExceptionReportingTests.test_exceptio[31 chars] X\n'
- __main__.BaseExceptionReportingTests.test_exception_qualname.<locals>.A.B.X: I am X
? ---------
+ BaseExceptionReportingTests.test_exception_qualname.<locals>.A.B.X: I am X


----------------------------------------------------------------------
Ran 145 tests in 1.129s

FAILED (failures=4)