Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-134565: Use ExceptionGroup to handle multiple errors in unittest.doModuleCleanups()#134566
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
gh-134565: Use ExceptionGroup to handle multiple errors in unittest.doModuleCleanups()#134566
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…test.doModuleCleanup()
Uh oh!
There was an error while loading.Please reload this page.
…eanups-multiple-errors' into unittest-doModuleCleanups-multiple-errors
This looks like an API breaking change, it could break people's tests. |
e = e.exceptions[0] | ||
self.assertEqual(str(e), 'CleanUpExc (2 sub-exceptions)') | ||
self.assertEqual(str(e.exceptions[0]), 'CleanUpExc1') | ||
self.assertEqual(str(e.exceptions[1]), 'CleanUpExc2') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We have a utility for this check:Lib/test/support/testcase.py: def assertExceptionIsLike(self, exc, template):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Normally exceptions are not raised in test cleanup code, so I do not think this change will break people's tests. It will change the error report to better if there were multiple errors.
e = e.exceptions[0] | ||
self.assertEqual(str(e), 'CleanUpExc (2 sub-exceptions)') | ||
self.assertEqual(str(e.exceptions[0]), 'CleanUpExc1') | ||
self.assertEqual(str(e.exceptions[1]), 'CleanUpExc2') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Done.
Thank you for your review@iritkatriel. |
393773a
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.