Skip to content

Commit a328a13

Browse files
[3.9] bpo-45097: Fix deprecation warnings in test_asyncio (GH-28236)
1 parent 99506dc commit a328a13

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Lib/test/test_asyncio/test_tasks.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def run():
155155
self.loop.run_until_complete(
156156
asyncio.gather(*[
157157
self.new_task(self.loop, run()) for _ in range(100)
158-
], loop=self.loop))
158+
]))
159159

160160
def test_other_loop_future(self):
161161
other_loop = asyncio.new_event_loop()
@@ -2519,7 +2519,8 @@ def test_cancel_gather_1(self):
25192519
# gathering task is done at the same time as the child future
25202520
def child_coro():
25212521
return (yield from fut)
2522-
gather_future = asyncio.gather(child_coro(), loop=loop)
2522+
with self.assertWarns(DeprecationWarning):
2523+
gather_future = asyncio.gather(child_coro(), loop=loop)
25232524
gather_task = asyncio.ensure_future(gather_future, loop=loop)
25242525

25252526
cancel_result = None
@@ -2555,7 +2556,8 @@ async def test():
25552556
time = 0
25562557
while True:
25572558
time += 0.05
2558-
await asyncio.gather(asyncio.sleep(0.05),
2559+
with self.assertWarns(DeprecationWarning):
2560+
await asyncio.gather(asyncio.sleep(0.05),
25592561
return_exceptions=True,
25602562
loop=loop)
25612563
if time > 1:
@@ -2773,7 +2775,7 @@ async def main():
27732775
task = loop.create_task(sub(random.randint(0, 10)))
27742776
tasks.append(task)
27752777

2776-
await asyncio.gather(*tasks, loop=loop)
2778+
await asyncio.gather(*tasks)
27772779

27782780
loop = asyncio.new_event_loop()
27792781
try:

0 commit comments

Comments
 (0)