Skip to content

Commit dd46221

Browse files
committed
assert the child did not finish
1 parent 62ab3f8 commit dd46221

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Lib/test/test_asyncio/test_taskgroups.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,13 +1156,17 @@ async def test_taskgroup_cancel_before_create_task(self):
11561156

11571157
async def test_taskgroup_cancel_from_child_before_first_suspension(self):
11581158
# gh-155418: an eager task can cancel the group before joining _tasks
1159+
done = []
1160+
11591161
async def child(tg):
11601162
tg.cancel()
11611163
await asyncio.sleep(10)
1164+
done.append(True)
11621165

11631166
async with asyncio.TaskGroup() as tg:
11641167
task = tg.create_task(child(tg))
11651168
self.assertTrue(task.cancelled())
1169+
self.assertEqual(done, [])
11661170

11671171
async def test_taskgroup_cancel_before_exception(self):
11681172
async def raise_exc(parent_tg: asyncio.TaskGroup):

0 commit comments

Comments
 (0)