summaryrefslogtreecommitdiff
path: root/Lib/test/test_asyncgen.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2018-10-02 13:53:06 -0400
committerGitHub <noreply@github.com>2018-10-02 13:53:06 -0400
commit9012a0fb4c4ec1afef9efb9fdb0964554ea17983 (patch)
tree87ff02fec1fa16d87b30e8b1028e71ea624b5b48 /Lib/test/test_asyncgen.py
parent11c4eaa99362f91c7faea88e31df3e46af020023 (diff)
downloadcpython-git-9012a0fb4c4ec1afef9efb9fdb0964554ea17983.tar.gz
bpo-34728: Fix asyncio tests to run under "-Werror" (GH-9661)
Diffstat (limited to 'Lib/test/test_asyncgen.py')
-rw-r--r--Lib/test/test_asyncgen.py96
1 files changed, 48 insertions, 48 deletions
diff --git a/Lib/test/test_asyncgen.py b/Lib/test/test_asyncgen.py
index 9d60cb0e7e..71b0968c79 100644
--- a/Lib/test/test_asyncgen.py
+++ b/Lib/test/test_asyncgen.py
@@ -395,9 +395,9 @@ class AsyncGenAsyncioTest(unittest.TestCase):
def test_async_gen_asyncio_01(self):
async def gen():
yield 1
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield 2
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
return
yield 3
@@ -407,7 +407,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
def test_async_gen_asyncio_02(self):
async def gen():
yield 1
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield 2
1 / 0
yield 3
@@ -421,7 +421,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
class Gen:
async def __aiter__(self):
yield 1
- await asyncio.sleep(0.01, loop=loop)
+ await asyncio.sleep(0.01)
yield 2
res = loop.run_until_complete(self.to_list(Gen()))
@@ -430,13 +430,13 @@ class AsyncGenAsyncioTest(unittest.TestCase):
def test_async_gen_asyncio_anext_04(self):
async def foo():
yield 1
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
try:
yield 2
yield 3
except ZeroDivisionError:
yield 1000
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield 4
async def run1():
@@ -587,7 +587,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
yield 1
1 / 0
finally:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield 12
async def run():
@@ -610,8 +610,8 @@ class AsyncGenAsyncioTest(unittest.TestCase):
yield 1
1 / 0
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE += 1
DONE += 1000
@@ -637,8 +637,8 @@ class AsyncGenAsyncioTest(unittest.TestCase):
DONE += 1000
yield 2
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE += 1
DONE += 1000
@@ -647,7 +647,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
it = gen.__aiter__()
self.assertEqual(await it.__anext__(), 1)
t = self.loop.create_task(it.__anext__())
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
await gen.aclose()
return t
@@ -657,7 +657,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
# Silence ResourceWarnings
fut.cancel()
t.cancel()
- self.loop.run_until_complete(asyncio.sleep(0.01, loop=self.loop))
+ self.loop.run_until_complete(asyncio.sleep(0.01))
def test_async_gen_asyncio_gc_aclose_09(self):
DONE = 0
@@ -668,8 +668,8 @@ class AsyncGenAsyncioTest(unittest.TestCase):
while True:
yield 1
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -678,7 +678,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
await g.__anext__()
del g
- await asyncio.sleep(0.1, loop=self.loop)
+ await asyncio.sleep(0.1)
self.loop.run_until_complete(run())
self.assertEqual(DONE, 1)
@@ -769,15 +769,15 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen():
nonlocal DONE
try:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
v = yield 1
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield v * 2
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
return
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -799,20 +799,20 @@ class AsyncGenAsyncioTest(unittest.TestCase):
DONE = 0
async def sleep_n_crash(delay):
- await asyncio.sleep(delay, loop=self.loop)
+ await asyncio.sleep(delay)
1 / 0
async def gen():
nonlocal DONE
try:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
v = yield 1
await sleep_n_crash(0.01)
DONE += 1000
yield v * 2
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -831,7 +831,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
DONE = 0
async def sleep_n_crash(delay):
- fut = asyncio.ensure_future(asyncio.sleep(delay, loop=self.loop),
+ fut = asyncio.ensure_future(asyncio.sleep(delay),
loop=self.loop)
self.loop.call_later(delay / 2, lambda: fut.cancel())
return await fut
@@ -839,14 +839,14 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen():
nonlocal DONE
try:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
v = yield 1
await sleep_n_crash(0.01)
DONE += 1000
yield v * 2
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -885,18 +885,18 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen():
nonlocal DONE
try:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
try:
v = yield 1
except FooEr:
v = 1000
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield v * 2
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
# return
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -921,7 +921,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
pass
async def sleep_n_crash(delay):
- fut = asyncio.ensure_future(asyncio.sleep(delay, loop=self.loop),
+ fut = asyncio.ensure_future(asyncio.sleep(delay),
loop=self.loop)
self.loop.call_later(delay / 2, lambda: fut.cancel())
return await fut
@@ -929,17 +929,17 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen():
nonlocal DONE
try:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
try:
v = yield 1
except FooEr:
await sleep_n_crash(0.01)
yield v * 2
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
# return
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -1038,10 +1038,10 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def waiter(timeout):
nonlocal finalized
try:
- await asyncio.sleep(timeout, loop=self.loop)
+ await asyncio.sleep(timeout)
yield 1
finally:
- await asyncio.sleep(0, loop=self.loop)
+ await asyncio.sleep(0)
finalized += 1
async def wait():
@@ -1051,7 +1051,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
t1 = self.loop.create_task(wait())
t2 = self.loop.create_task(wait())
- self.loop.run_until_complete(asyncio.sleep(0.1, loop=self.loop))
+ self.loop.run_until_complete(asyncio.sleep(0.1))
self.loop.run_until_complete(self.loop.shutdown_asyncgens())
self.assertEqual(finalized, 2)
@@ -1059,7 +1059,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
# Silence warnings
t1.cancel()
t2.cancel()
- self.loop.run_until_complete(asyncio.sleep(0.1, loop=self.loop))
+ self.loop.run_until_complete(asyncio.sleep(0.1))
def test_async_gen_asyncio_shutdown_02(self):
logged = 0
@@ -1073,7 +1073,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def waiter(timeout):
try:
- await asyncio.sleep(timeout, loop=self.loop)
+ await asyncio.sleep(timeout)
yield 1
finally:
1 / 0
@@ -1083,7 +1083,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
pass
t = self.loop.create_task(wait())
- self.loop.run_until_complete(asyncio.sleep(0.1, loop=self.loop))
+ self.loop.run_until_complete(asyncio.sleep(0.1))
self.loop.set_exception_handler(logger)
self.loop.run_until_complete(self.loop.shutdown_asyncgens())
@@ -1092,12 +1092,12 @@ class AsyncGenAsyncioTest(unittest.TestCase):
# Silence warnings
t.cancel()
- self.loop.run_until_complete(asyncio.sleep(0.1, loop=self.loop))
+ self.loop.run_until_complete(asyncio.sleep(0.1))
def test_async_gen_expression_01(self):
async def arange(n):
for i in range(n):
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield i
def make_arange(n):
@@ -1112,7 +1112,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
def test_async_gen_expression_02(self):
async def wrap(n):
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
return n
def make_arange(n):