gh-128308: pass **kwargs to asyncio task_factory (#128768)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Thomas Grainger 2025-01-20 16:53:55 +00:00 committed by GitHub
parent 6c914bf85c
commit 38a9956876
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 48 additions and 29 deletions

View file

@ -1040,6 +1040,18 @@ class BaseTestTaskGroup:
self.assertIsNotNone(exc)
self.assertListEqual(gc.get_referrers(exc), no_other_refs())
async def test_name(self):
name = None
async def asyncfn():
nonlocal name
name = asyncio.current_task().get_name()
async with asyncio.TaskGroup() as tg:
tg.create_task(asyncfn(), name="example name")
self.assertEqual(name, "example name")
class TestTaskGroup(BaseTestTaskGroup, unittest.IsolatedAsyncioTestCase):
loop_factory = asyncio.EventLoop