Skip to content

bpo-46425: fix direct invocation of test_traceback - #30746

Merged
asvetlov merged 3 commits into
python:mainfrom
sobolevn:issue-46425-traceback
Jan 22, 2022
Merged

bpo-46425: fix direct invocation of test_traceback#30746
asvetlov merged 3 commits into
python:mainfrom
sobolevn:issue-46425-traceback

Conversation

@sobolevn

@sobolevnsobolevn commented Jan 21, 2022

Copy link
Copy Markdown
Member

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.

@isidenticalisidentical left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment threadLib/test/test_traceback.py Outdated
@sobolevnsobolevn reopened this Jan 22, 2022
@sobolevnsobolevn reopened this Jan 22, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@sobolevn@asvetlov@isidentical@raghavthind2005@the-knights-who-say-ni@bedevere-bot