Skip to content

Commit bce1fb1

Browse files
committed
make tests more explicit
1 parent 2cfa1e6 commit bce1fb1

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

Lib/test/test_asyncio/test_taskgroups.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33

44
import sys
55
import gc
6-
76
import asyncio
87
import contextvars
98
import contextlib
109
from asyncio import taskgroups
11-
import math
1210
import unittest
1311
import warnings
1412

@@ -1000,11 +998,13 @@ class MyKeyboardInterrupt(KeyboardInterrupt):
1000998
self.assertListEqual(gc.get_referrers(exc), no_other_refs())
1001999

10021000
async def test_taskgroup_stop_children(self):
1003-
async with asyncio.TaskGroup() as tg:
1004-
tg.create_task(asyncio.sleep(math.inf))
1005-
tg.create_task(asyncio.sleep(math.inf))
1006-
await asyncio.sleep(0)
1007-
tg.stop()
1001+
# (asserting that TimeoutError is not raised)
1002+
async with asyncio.timeout(1):
1003+
async with asyncio.TaskGroup() as tg:
1004+
tg.create_task(asyncio.sleep(10))
1005+
tg.create_task(asyncio.sleep(10))
1006+
await asyncio.sleep(0)
1007+
tg.stop()
10081008

10091009
async def test_taskgroup_stop_body(self):
10101010
count = 0
@@ -1028,6 +1028,7 @@ async def test_taskgroup_stop_idempotent(self):
10281028
async def test_taskgroup_stop_after_exit(self):
10291029
async with asyncio.TaskGroup() as tg:
10301030
await asyncio.sleep(0)
1031+
# (asserting that exception is not raised)
10311032
tg.stop()
10321033

10331034
async def test_taskgroup_stop_before_enter(self):

0 commit comments

Comments
 (0)