René's URL Explorer Experiment


Title: bpo-32972: Async test case by asvetlov · Pull Request #13386 · python/cpython · GitHub

Open Graph Title: bpo-32972: Async test case by asvetlov · Pull Request #13386 · python/cpython

X Title: bpo-32972: Async test case by asvetlov · Pull Request #13386 · python/cpython

Description: Add explicit asyncSetUp and asyncTearDown methods. The rest is the same as for #13228 AsyncTestCase create a loop instance for every test for the sake of test isolation. Sometimes a loop shared between all tests can speed up tests execution time a lot but it requires control of closed resources after every test finish. Basically, it requires nested supervisors support that was discussed with @1st1 many times. Sorry, asyncio supervisors have no chance to land on Python 3.8. The PR intentionally does not provide API for changing the used event loop or getting the test loop: use asyncio.set_event_loop_policy() and asyncio.get_event_loop() instead. The PR adds four overridable methods to base unittest.TestCase class: def _callSetUp(self): self.setUp() def _callTestMethod(self, method): method() def _callTearDown(self): self.tearDown() def _callCleanup(self, function, /, *args, **kwargs): function(*args, **kwargs) It allows using asyncio facilities with minimal influence on the unittest code. The last but not least: the PR respects contextvars. The context variable installed by asyncSetUp is available on test, tearDown and a coroutine scheduled by addCleanup. https://bugs.python.org/issue32972

Open Graph Description: Add explicit asyncSetUp and asyncTearDown methods. The rest is the same as for #13228 AsyncTestCase create a loop instance for every test for the sake of test isolation. Sometimes a loop shared bet...

X Description: Add explicit asyncSetUp and asyncTearDown methods. The rest is the same as for #13228 AsyncTestCase create a loop instance for every test for the sake of test isolation. Sometimes a loop shared bet...

Opengraph URL: https://github.com/python/cpython/pull/13386

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:be48ca26-25dc-3016-894e-4fea2bc55a89
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9692:44769:A7003:F3CC2:6A573BD6
html-safe-nonce31309dc8be9e1c6032616ee121700423323fc54935a787e53610080857812905
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjkyOjQ0NzY5OkE3MDAzOkYzQ0MyOjZBNTczQkQ2IiwidmlzaXRvcl9pZCI6IjEyMDY5MTkwOTc5NTY2NDU4NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc7e5213134aaeae0e2620f7d5322b99d441d564d45e876a2e70e6e9e6af34cad
hovercard-subject-tagpull_request:279864937
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/13386/files
twitter:imagehttps://avatars.githubusercontent.com/u/356399?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/356399?s=400&v=4
og:image:altAdd explicit asyncSetUp and asyncTearDown methods. The rest is the same as for #13228 AsyncTestCase create a loop instance for every test for the sake of test isolation. Sometimes a loop shared bet...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2576d1f0198cf1588faf2edf27f1ed120903be10
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/13386/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F13386%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F13386%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/13386/files
Reloadhttps://github.com/python/cpython/pull/13386/files
Reloadhttps://github.com/python/cpython/pull/13386/files
Please reload this pagehttps://github.com/python/cpython/pull/13386/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/13386/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
miss-islingtonhttps://github.com/miss-islington
python:masterhttps://github.com/python/cpython/tree/master
asvetlov:async-test-case2https://github.com/asvetlov/cpython/tree/async-test-case2
Conversation 11 https://github.com/python/cpython/pull/13386
Commits 19 https://github.com/python/cpython/pull/13386/commits
Checks 0 https://github.com/python/cpython/pull/13386/checks
Files changed https://github.com/python/cpython/pull/13386/files
Please reload this pagehttps://github.com/python/cpython/pull/13386/files
bpo-32972: Async test case https://github.com/python/cpython/pull/13386/files#top
Show all changes 19 commits https://github.com/python/cpython/pull/13386/files
b77e62d Test on asvetlov May 7, 2019 https://github.com/python/cpython/pull/13386/commits/b77e62d63bc19b0532a2ce57785d97ce078d7498
de89fda Work on asvetlov May 7, 2019 https://github.com/python/cpython/pull/13386/commits/de89fda86528693fef9b941db30573d67b7b4849
96fcbd9 Merge branch 'master' into async-test-case asvetlov May 9, 2019 https://github.com/python/cpython/pull/13386/commits/96fcbd9733802894aa19f250fe5c52b80ed83a9f
9eef723 Fix test method call asvetlov May 16, 2019 https://github.com/python/cpython/pull/13386/commits/9eef7236cafc33a2a809c928c4c0493c45b4da92
18cb7d4 Merge branch 'master' into async-test-case asvetlov May 16, 2019 https://github.com/python/cpython/pull/13386/commits/18cb7d4f5eeebcfd64386456bff921e6fcecafb3
43091a0 Code cleanup asvetlov May 16, 2019 https://github.com/python/cpython/pull/13386/commits/43091a015a970b64927d213663e8d326333a9ca8
d8ad4d7 Fix test by using positional-arguments only asvetlov May 16, 2019 https://github.com/python/cpython/pull/13386/commits/d8ad4d7e38be97131ea484878db93be043f2346d
85df707 Make basic test passing asvetlov May 16, 2019 https://github.com/python/cpython/pull/13386/commits/85df7070af27fbdc7b1009482b337424e20146b6
78d885f Test addCleanup asvetlov May 16, 2019 https://github.com/python/cpython/pull/13386/commits/78d885f71d5752051b1e18fd75fb8ad1ed9fd3c2
58cb1c8 Make test_support happy asvetlov May 16, 2019 https://github.com/python/cpython/pull/13386/commits/58cb1c86aba8ab299daa338ca10c7939a3990397
0853043 More tests asvetlov May 16, 2019 https://github.com/python/cpython/pull/13386/commits/085304384ac97dac5935c144045303503929b18d
03480c4 Prefix async setup/teardown methods asvetlov May 17, 2019 https://github.com/python/cpython/pull/13386/commits/03480c42788baafa47720316e661a33038dccf03
8b99f79 Check for setUp/tearDown calls explicitly asvetlov May 20, 2019 https://github.com/python/cpython/pull/13386/commits/8b99f79073cd33ba1bed37417c087a6f16e3b472
80e1898 Add NEWS asvetlov May 20, 2019 https://github.com/python/cpython/pull/13386/commits/80e1898865472fe7666abf56ea575cfee5817ad2
0d581af Merge branch 'master' into async-test-case2 asvetlov May 21, 2019 https://github.com/python/cpython/pull/13386/commits/0d581afc80d48ea30cdc12f4263cad2f7bb1de3b
7cedbf0 Rename asvetlov May 21, 2019 https://github.com/python/cpython/pull/13386/commits/7cedbf0c3a35c195e5171e41c1ccc38f6bf3e79e
30c78b5 Merge branch 'master' into async-test-case2 asvetlov May 27, 2019 https://github.com/python/cpython/pull/13386/commits/30c78b55f8d615443272c75353efd742a5f06c82
4cd1a86 Merge branch 'master' into async-test-case2 asvetlov May 28, 2019 https://github.com/python/cpython/pull/13386/commits/4cd1a865c37ab469c158f2fcfd2561eb45690e50
c1ac3b5 Support addAsyncCleanup() asvetlov May 28, 2019 https://github.com/python/cpython/pull/13386/commits/c1ac3b5ce32b00517c3e810f0e28675f538b2f8e
Clear filters https://github.com/python/cpython/pull/13386/files
Please reload this pagehttps://github.com/python/cpython/pull/13386/files
Please reload this pagehttps://github.com/python/cpython/pull/13386/files
test_support.py https://github.com/python/cpython/pull/13386/files#diff-cb42fd26146ec61cb2242243494a9f314667a9a39153ad17e37465ff5a8a8000
__init__.py https://github.com/python/cpython/pull/13386/files#diff-e278af08db15e97de9401e1860464084b8b0df53251127bc1189cd2458bf62d7
async_case.py https://github.com/python/cpython/pull/13386/files#diff-1f2ae0f6c6010caf9d5f1c80cd6033a796ffe2b60554f5df84f554f4a08e622b
case.py https://github.com/python/cpython/pull/13386/files#diff-c6fe1ffe930def48a6adf1fa99b974737bac586fdacccacd1474e7b2f11370eb
test_async_case.py https://github.com/python/cpython/pull/13386/files#diff-4a827db849ee7895edd365920bd4570cd772baec91ac3908bd794bce348ac4ad
2019-05-20-14-47-55.bpo-32972.LoeUNh.rst https://github.com/python/cpython/pull/13386/files#diff-eb6a36bbb10f709839e7f21d1a343eb794697792e01cc0c4b5ea49f855e365d1
Lib/test/test_support.pyhttps://github.com/python/cpython/pull/13386/files#diff-cb42fd26146ec61cb2242243494a9f314667a9a39153ad17e37465ff5a8a8000
View file https://github.com/asvetlov/cpython/blob/c1ac3b5ce32b00517c3e810f0e28675f538b2f8e/Lib/test/test_support.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/13386/{{ revealButtonHref }}
https://github.com/python/cpython/pull/13386/files#diff-cb42fd26146ec61cb2242243494a9f314667a9a39153ad17e37465ff5a8a8000
https://github.com/python/cpython/pull/13386/files#diff-cb42fd26146ec61cb2242243494a9f314667a9a39153ad17e37465ff5a8a8000
Lib/unittest/__init__.pyhttps://github.com/python/cpython/pull/13386/files#diff-e278af08db15e97de9401e1860464084b8b0df53251127bc1189cd2458bf62d7
View file https://github.com/asvetlov/cpython/blob/c1ac3b5ce32b00517c3e810f0e28675f538b2f8e/Lib/unittest/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/13386/{{ revealButtonHref }}
https://github.com/python/cpython/pull/13386/files#diff-e278af08db15e97de9401e1860464084b8b0df53251127bc1189cd2458bf62d7
https://github.com/python/cpython/pull/13386/files#diff-e278af08db15e97de9401e1860464084b8b0df53251127bc1189cd2458bf62d7
https://github.com/python/cpython/pull/13386/files#diff-e278af08db15e97de9401e1860464084b8b0df53251127bc1189cd2458bf62d7
Lib/unittest/async_case.pyhttps://github.com/python/cpython/pull/13386/files#diff-1f2ae0f6c6010caf9d5f1c80cd6033a796ffe2b60554f5df84f554f4a08e622b
View file https://github.com/asvetlov/cpython/blob/c1ac3b5ce32b00517c3e810f0e28675f538b2f8e/Lib/unittest/async_case.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/13386/{{ revealButtonHref }}
1st1https://github.com/1st1
May 20, 2019https://github.com/python/cpython/pull/13386/files#r285660321
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/13386/files
1st1https://github.com/1st1
May 20, 2019https://github.com/python/cpython/pull/13386/files#r285661185
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://docs.python.org/3/library/contextlib.html#contextlib.AsyncExitStack.push_async_callbackhttps://docs.python.org/3/library/contextlib.html#contextlib.AsyncExitStack.push_async_callback
Please reload this pagehttps://github.com/python/cpython/pull/13386/files
asvetlovhttps://github.com/asvetlov
May 20, 2019https://github.com/python/cpython/pull/13386/files#r285677232
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/13386/files
1st1https://github.com/1st1
May 27, 2019https://github.com/python/cpython/pull/13386/files#r287775452
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/13386/files
Lib/unittest/case.pyhttps://github.com/python/cpython/pull/13386/files#diff-c6fe1ffe930def48a6adf1fa99b974737bac586fdacccacd1474e7b2f11370eb
View file https://github.com/asvetlov/cpython/blob/c1ac3b5ce32b00517c3e810f0e28675f538b2f8e/Lib/unittest/case.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/13386/{{ revealButtonHref }}
https://github.com/python/cpython/pull/13386/files#diff-c6fe1ffe930def48a6adf1fa99b974737bac586fdacccacd1474e7b2f11370eb
https://github.com/python/cpython/pull/13386/files#diff-c6fe1ffe930def48a6adf1fa99b974737bac586fdacccacd1474e7b2f11370eb
https://github.com/python/cpython/pull/13386/files#diff-c6fe1ffe930def48a6adf1fa99b974737bac586fdacccacd1474e7b2f11370eb
https://github.com/python/cpython/pull/13386/files#diff-c6fe1ffe930def48a6adf1fa99b974737bac586fdacccacd1474e7b2f11370eb
https://github.com/python/cpython/pull/13386/files#diff-c6fe1ffe930def48a6adf1fa99b974737bac586fdacccacd1474e7b2f11370eb
https://github.com/python/cpython/pull/13386/files#diff-c6fe1ffe930def48a6adf1fa99b974737bac586fdacccacd1474e7b2f11370eb
Please reload this pagehttps://github.com/python/cpython/pull/13386/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.