Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-46425: fix direct invocation of test_traceback #30746

Merged
merged 3 commits into from
Jan 22, 2022

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jan 21, 2022

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:

if __name__ == "__main__":
unittest.main()
), we had several failures:

» ./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)

After this change both ways work:

Снимок экрана 2022-01-21 в 16 14 43

https://bugs.python.org/issue46425

CC @corona10 as my mentor.

Copy link
Member

@isidentical isidentical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Lib/test/test_traceback.py Outdated Show resolved Hide resolved
@sobolevn sobolevn closed this Jan 22, 2022
@sobolevn sobolevn reopened this Jan 22, 2022
@sobolevn sobolevn closed this Jan 22, 2022
@sobolevn sobolevn reopened this Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants