[Python-checkins] [3.9] bpo-45097: Fix deprecation warnings in test_asyncio (GH-28236)
ambv
webhook-mailer at python.org
Wed Sep 8 11:59:51 EDT 2021
https://github.com/python/cpython/commit/a328a13b70ea0b0bec8b9d1b0067628369cabea9
commit: a328a13b70ea0b0bec8b9d1b0067628369cabea9
branch: 3.9
author: Serhiy Storchaka <storchaka at gmail.com>
committer: ambv <lukasz at langa.pl>
date: 2021-09-08T17:59:40+02:00
summary:
[3.9] bpo-45097: Fix deprecation warnings in test_asyncio (GH-28236)
files:
M Lib/test/test_asyncio/test_tasks.py
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 5e14b62be1845b..e25c0a697fa18e 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -155,7 +155,7 @@ async def run():
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 @@ def test_cancel_gather_1(self):
# 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 @@ async def test():
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 @@ async def main():
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:
More information about the Python-checkins
mailing list