diff options
author | Yury Selivanov <yury@magic.io> | 2018-10-02 13:53:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-02 13:53:06 -0400 |
commit | 9012a0fb4c4ec1afef9efb9fdb0964554ea17983 (patch) | |
tree | 87ff02fec1fa16d87b30e8b1028e71ea624b5b48 /Lib/test/test_asyncio/test_queues.py | |
parent | 11c4eaa99362f91c7faea88e31df3e46af020023 (diff) | |
download | cpython-git-9012a0fb4c4ec1afef9efb9fdb0964554ea17983.tar.gz |
bpo-34728: Fix asyncio tests to run under "-Werror" (GH-9661)
Diffstat (limited to 'Lib/test/test_asyncio/test_queues.py')
-rw-r--r-- | Lib/test/test_asyncio/test_queues.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Lib/test/test_asyncio/test_queues.py b/Lib/test/test_asyncio/test_queues.py index eba66e790d..b0f0f9c8fd 100644 --- a/Lib/test/test_asyncio/test_queues.py +++ b/Lib/test/test_asyncio/test_queues.py @@ -45,7 +45,7 @@ class QueueBasicTests(_QueueTestBase): # Start a task that waits to get. asyncio.Task(q.get(), loop=loop) # Let it start waiting. - await asyncio.sleep(0.1, loop=loop) + await asyncio.sleep(0.1) self.assertTrue('_getters[1]' in fn(q)) # resume q.get coroutine to finish generator q.put_nowait(0) @@ -58,7 +58,7 @@ class QueueBasicTests(_QueueTestBase): # Start a task that waits to put. asyncio.Task(q.put(2), loop=loop) # Let it start waiting. - await asyncio.sleep(0.1, loop=loop) + await asyncio.sleep(0.1) self.assertTrue('_putters[1]' in fn(q)) # resume q.put coroutine to finish generator q.get_nowait() @@ -135,14 +135,14 @@ class QueueBasicTests(_QueueTestBase): async def test(): t = asyncio.Task(putter(), loop=loop) - await asyncio.sleep(0.01, loop=loop) + await asyncio.sleep(0.01) # The putter is blocked after putting two items. self.assertEqual([0, 1], have_been_put) self.assertEqual(0, q.get_nowait()) # Let the putter resume and put last item. - await asyncio.sleep(0.01, loop=loop) + await asyncio.sleep(0.01) self.assertEqual([0, 1, 2], have_been_put) self.assertEqual(1, q.get_nowait()) self.assertEqual(2, q.get_nowait()) @@ -234,11 +234,11 @@ class QueueGetTests(_QueueTestBase): q = asyncio.Queue(loop=loop) async def queue_get(): - return await asyncio.wait_for(q.get(), 0.051, loop=loop) + return await asyncio.wait_for(q.get(), 0.051) async def test(): get_task = asyncio.Task(queue_get(), loop=loop) - await asyncio.sleep(0.01, loop=loop) # let the task start + await asyncio.sleep(0.01) # let the task start q.put_nowait(1) return await get_task @@ -297,7 +297,7 @@ class QueueGetTests(_QueueTestBase): async def consumer(queue): try: - item = await asyncio.wait_for(queue.get(), 0.1, loop=self.loop) + item = await asyncio.wait_for(queue.get(), 0.1) except asyncio.TimeoutError: pass @@ -364,7 +364,7 @@ class QueuePutTests(_QueueTestBase): reader = loop.create_task(q.get()) - loop.run_until_complete(asyncio.sleep(0.01, loop=loop)) + loop.run_until_complete(asyncio.sleep(0.01)) q.put_nowait(1) q.put_nowait(2) @@ -395,7 +395,7 @@ class QueuePutTests(_QueueTestBase): reader2 = loop.create_task(q.get()) reader3 = loop.create_task(q.get()) - loop.run_until_complete(asyncio.sleep(0.01, loop=loop)) + loop.run_until_complete(asyncio.sleep(0.01)) q.put_nowait(1) q.put_nowait(2) @@ -424,7 +424,7 @@ class QueuePutTests(_QueueTestBase): # putting a second item in the queue has to block (qsize=1) writer = loop.create_task(q.put(2)) - loop.run_until_complete(asyncio.sleep(0.01, loop=loop)) + loop.run_until_complete(asyncio.sleep(0.01)) value1 = q.get_nowait() self.assertEqual(value1, 1) @@ -512,7 +512,7 @@ class QueuePutTests(_QueueTestBase): await queue.put(item) async def getter(): - await asyncio.sleep(0, loop=self.loop) + await asyncio.sleep(0) num = queue.qsize() for _ in range(num): item = queue.get_nowait() @@ -537,7 +537,7 @@ class QueuePutTests(_QueueTestBase): # Task waiting for space to put an item in the queue. put_task = loop.create_task(queue.put(1)) - loop.run_until_complete(asyncio.sleep(0.01, loop=loop)) + loop.run_until_complete(asyncio.sleep(0.01)) # Check that the putter is correctly removed from queue._putters when # the task is canceled. @@ -560,7 +560,7 @@ class QueuePutTests(_QueueTestBase): # Task waiting for space to put a item in the queue. put_task = loop.create_task(queue.put(1)) - loop.run_until_complete(asyncio.sleep(0.01, loop=loop)) + loop.run_until_complete(asyncio.sleep(0.01)) # get_nowait() remove the future of put_task from queue._putters. queue.get_nowait() @@ -638,7 +638,7 @@ class _QueueJoinTestMixin: running = False for i in range(len(tasks)): q.put_nowait(0) - self.loop.run_until_complete(asyncio.wait(tasks, loop=self.loop)) + self.loop.run_until_complete(asyncio.wait(tasks)) def test_join_empty_queue(self): q = self.q_class(loop=self.loop) |