Title: `IsolatedAsyncioTestCase` does not call `asyncio.set_event_loop` before `setUp` anymore, `asyncio.Runner`+`PidFdChildWatcher` leaves zombie processes · Issue #95736 · python/cpython · GitHub
Open Graph Title: `IsolatedAsyncioTestCase` does not call `asyncio.set_event_loop` before `setUp` anymore, `asyncio.Runner`+`PidFdChildWatcher` leaves zombie processes · Issue #95736 · python/cpython
X Title: `IsolatedAsyncioTestCase` does not call `asyncio.set_event_loop` before `setUp` anymore, `asyncio.Runner`+`PidFdChildWatcher` leaves zombie processes · Issue #95736 · python/cpython
Description: demo reproducer: import unittest import asyncio class DemoTestCase1(unittest.IsolatedAsyncioTestCase): def setUp(self): self.loop = asyncio.get_event_loop_policy().get_event_loop() async def test_demo(self): print("hello!") class DemoTes...
Open Graph Description: demo reproducer: import unittest import asyncio class DemoTestCase1(unittest.IsolatedAsyncioTestCase): def setUp(self): self.loop = asyncio.get_event_loop_policy().get_event_loop() async def test_d...
X Description: demo reproducer: import unittest import asyncio class DemoTestCase1(unittest.IsolatedAsyncioTestCase): def setUp(self): self.loop = asyncio.get_event_loop_policy().get_event_loop() async def test_d...
Opengraph URL: https://github.com/python/cpython/issues/95736
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`IsolatedAsyncioTestCase` does not call `asyncio.set_event_loop` before `setUp` anymore, `asyncio.Runner`+`PidFdChildWatcher` leaves zombie processes","articleBody":"demo reproducer:\r\n\r\n```python\r\nimport unittest\r\nimport asyncio\r\n\r\nclass DemoTestCase1(unittest.IsolatedAsyncioTestCase):\r\n def setUp(self):\r\n self.loop = asyncio.get_event_loop_policy().get_event_loop()\r\n\r\n async def test_demo(self):\r\n print(\"hello!\")\r\n\r\n\r\nclass DemoTestCase2(unittest.IsolatedAsyncioTestCase):\r\n def setUp(self):\r\n self.loop = asyncio.get_event_loop_policy().get_event_loop()\r\n\r\n async def test_demo(self):\r\n print(\"hello!\")\r\n\r\nif __name__ == \"__main__\":\r\n unittest.main()\r\n```\r\n\r\nsee also https://github.com/python/cpython/issues/93896\r\n\r\n\r\n```\r\n graingert@conscientious testing310 ~/projects python3.10 foo.py \r\nhello!\r\n.hello!\r\n.\r\n----------------------------------------------------------------------\r\nRan 2 tests in 0.002s\r\n\r\nOK\r\n```\r\n\r\n```\r\n graingert@conscientious testing310 ~/projects python3.11 foo.py \r\nhello!\r\n.E\r\n======================================================================\r\nERROR: test_demo (__main__.DemoTestCase2.test_demo)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n File \"/usr/lib/python3.11/unittest/async_case.py\", line 82, in _callSetUp\r\n self._asyncioTestContext.run(self.setUp)\r\n File \"/home/graingert/projects/foo.py\", line 14, in setUp\r\n self.loop = asyncio.get_event_loop_policy().get_event_loop()\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/usr/lib/python3.11/asyncio/events.py\", line 677, in get_event_loop\r\n raise RuntimeError('There is no current event loop in thread %r.'\r\nRuntimeError: There is no current event loop in thread 'MainThread'.\r\n\r\n----------------------------------------------------------------------\r\nRan 2 tests in 0.002s\r\n\r\nFAILED (errors=1)\r\n```\r\n\r\nit looks like this is because `asyncio.Runner` calls `asyncio.set_event_loop(` in `Runner.run`","author":{"url":"https://github.com/graingert","@type":"Person","name":"graingert"},"datePublished":"2022-08-06T08:50:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":23},"url":"https://github.com/95736/cpython/issues/95736"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bc8aab78-95b7-b892-f590-2fb9921f5de6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B616:20C85F:7931A7:A4E50E:6969DBFB |
| html-safe-nonce | c020f8631aa2f0140e96e3db40ed25943e5b6e47a98c3fb69d916de08f362e36 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjE2OjIwQzg1Rjo3OTMxQTc6QTRFNTBFOjY5NjlEQkZCIiwidmlzaXRvcl9pZCI6IjMwNzc1Njk3MDU0NTk0NDA2MzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 33ce12bab6d0ebe6dd258ad90509a506fdbabe78c0e1f603be8ff5ecba323768 |
| hovercard-subject-tag | issue:1330695075 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/95736/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fc32c66286c881c1beb221eae85c14a66264c3dbdb09bf33af3892e6c06fbfbb/python/cpython/issues/95736 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fc32c66286c881c1beb221eae85c14a66264c3dbdb09bf33af3892e6c06fbfbb/python/cpython/issues/95736 |
| og:image:alt | demo reproducer: import unittest import asyncio class DemoTestCase1(unittest.IsolatedAsyncioTestCase): def setUp(self): self.loop = asyncio.get_event_loop_policy().get_event_loop() async def test_d... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | graingert |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width