-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-45046: Support context managers in unittest #28045
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-45046: Support context managers in unittest #28045
Conversation
Add methods enterContext() and enterClassContext() in TestCase. Add method enterAsyncContext() in IsolatedAsyncioTestCase. Add function enterModuleContext().
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.
I support this feature
@pablogsal, I ask a permission to land this in 3.11. The PR was already ready 7 months ago, I only wanted to rewrite some tests in other issues before merging it, and missed the freeze data. |
Ok, no problem. Thanks for checking with me. I think we can make an exception here. I added the 3.11 backport label so just land it and proceed with the backport. Thanks for the great work @serhiy-storchaka |
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Add methods enterContext() and enterClassContext() in TestCase. Add method enterAsyncContext() in IsolatedAsyncioTestCase. Add function enterModuleContext(). (cherry picked from commit 086c6b1) Co-authored-by: Serhiy Storchaka <[email protected]>
GH-92479 is a backport of this pull request to the 3.11 branch. |
Add methods enterContext() and enterClassContext() in TestCase. Add method enterAsyncContext() in IsolatedAsyncioTestCase. Add function enterModuleContext(). (cherry picked from commit 086c6b1) Co-authored-by: Serhiy Storchaka <[email protected]>
Add methods enterContext() and enterClassContext() in TestCase.
Add method enterAsyncContext() in IsolatedAsyncioTestCase.
Add function enterModuleContext().
https://bugs.python.org/issue45046