Skip to content

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

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
@pablogsal pablogsal removed their request for review August 30, 2021 17:41
@ned-deily ned-deily removed the request for review from a team September 5, 2021 20:21
Copy link
Contributor

@asvetlov asvetlov left a 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

@serhiy-storchaka
Copy link
Member Author

@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 pablogsal added the needs backport to 3.11 only security fixes label May 8, 2022
@pablogsal
Copy link
Member

@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
@miss-islington
Copy link
Contributor

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 14:49
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 <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label May 8, 2022
@bedevere-bot
Copy link

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 <[email protected]>
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.

6 participants