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-45046: Support context managers in unittest #28045

Merged
merged 10 commits into from May 8, 2022

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Aug 29, 2021

Add methods enterContext() and enterClassContext() in TestCase.
Add method enterAsyncContext() in IsolatedAsyncioTestCase.
Add function enterModuleContext().

https://bugs.python.org/issue45046

Add methods enterContext() and enterClassContext() in TestCase.
Add method enterAsyncContext() in IsolatedAsyncioTestCase.
Add function enterModuleContext().
@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Aug 29, 2021
@serhiy-storchaka serhiy-storchaka requested review from lysnikolaou, pablogsal and a team as code owners Aug 29, 2021
@pablogsal pablogsal removed their request for review Aug 30, 2021
@ned-deily ned-deily removed the request for review from a team Sep 5, 2021
@serhiy-storchaka serhiy-storchaka requested a review from vsajip as a code owner Sep 19, 2021
Copy link
Contributor

@asvetlov asvetlov left a comment

I support this feature

@serhiy-storchaka
Copy link
Member Author

serhiy-storchaka commented May 8, 2022

@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.

@pablogsal
Copy link
Member

pablogsal commented May 8, 2022

@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 ♥️

@serhiy-storchaka serhiy-storchaka merged commit 086c6b1 into python:main May 8, 2022
14 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented May 8, 2022

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒🤖

@serhiy-storchaka serhiy-storchaka deleted the unittest-entercontext branch May 8, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 8, 2022
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 <storchaka@gmail.com>
@bedevere-bot
Copy link

bedevere-bot commented May 8, 2022

GH-92479 is a backport of this pull request to the 3.11 branch.

miss-islington added a commit that referenced this pull request May 8, 2022
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 <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants