mirror of
https://github.com/python/cpython.git
synced 2025-08-19 00:00:48 +00:00
[3.9] bpo-45097: Fix deprecation warnings in test_asyncio (GH-28236)
This commit is contained in:
parent
99506dcbbe
commit
a328a13b70
1 changed files with 6 additions and 4 deletions
|
@ -155,7 +155,7 @@ class BaseTaskTests:
|
|||
self.loop.run_until_complete(
|
||||
asyncio.gather(*[
|
||||
self.new_task(self.loop, run()) for _ in range(100)
|
||||
], loop=self.loop))
|
||||
]))
|
||||
|
||||
def test_other_loop_future(self):
|
||||
other_loop = asyncio.new_event_loop()
|
||||
|
@ -2519,7 +2519,8 @@ class BaseTaskTests:
|
|||
# gathering task is done at the same time as the child future
|
||||
def child_coro():
|
||||
return (yield from fut)
|
||||
gather_future = asyncio.gather(child_coro(), loop=loop)
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
gather_future = asyncio.gather(child_coro(), loop=loop)
|
||||
gather_task = asyncio.ensure_future(gather_future, loop=loop)
|
||||
|
||||
cancel_result = None
|
||||
|
@ -2555,7 +2556,8 @@ class BaseTaskTests:
|
|||
time = 0
|
||||
while True:
|
||||
time += 0.05
|
||||
await asyncio.gather(asyncio.sleep(0.05),
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
await asyncio.gather(asyncio.sleep(0.05),
|
||||
return_exceptions=True,
|
||||
loop=loop)
|
||||
if time > 1:
|
||||
|
@ -2773,7 +2775,7 @@ class BaseTaskTests:
|
|||
task = loop.create_task(sub(random.randint(0, 10)))
|
||||
tasks.append(task)
|
||||
|
||||
await asyncio.gather(*tasks, loop=loop)
|
||||
await asyncio.gather(*tasks)
|
||||
|
||||
loop = asyncio.new_event_loop()
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue