We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8345647 commit 7235c20Copy full SHA for 7235c20
1 file changed
Lib/test/test_asyncio/test_taskgroups.py
@@ -1041,6 +1041,14 @@ async def test_taskgroup_cancel_before_enter(self):
1041
count += 1
1042
self.assertEqual(count, 1)
1043
1044
+ async def test_taskgroup_cancel_before_create_task(self):
1045
+ async with asyncio.TaskGroup() as tg:
1046
+ tg.cancel()
1047
+ # TODO: This behavior is not ideal. We'd rather have no exception
1048
+ # raised, and the child task run until the first await.
1049
+ with self.assertRaises(RuntimeError):
1050
+ tg.create_task(asyncio.sleep(1))
1051
+
1052
async def test_taskgroup_cancel_before_exception(self):
1053
async def raise_exc(parent_tg: asyncio.TaskGroup):
1054
parent_tg.cancel()
0 commit comments