aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_queues.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-04-25 13:40:44 +0300
committerGitHub <noreply@github.com>2021-04-25 13:40:44 +0300
commit172c0f2752d8708b6dda7b42e6c5a3519420a4e8 (patch)
tree35a076c6baad7ca053a62b9f505af3762a867b79 /Lib/test/test_asyncio/test_queues.py
parentface87c94e67ad9c72b9a3724f112fd76c1002b9 (diff)
downloadcpython-172c0f2752d8708b6dda7b42e6c5a3519420a4e8.tar.gz
cpython-172c0f2752d8708b6dda7b42e6c5a3519420a4e8.zip
bpo-39529: Deprecate creating new event loop in asyncio.get_event_loop() (GH-23554)
asyncio.get_event_loop() emits now a deprecation warning when it creates a new event loop. In future releases it will became an alias of asyncio.get_running_loop().
Diffstat (limited to 'Lib/test/test_asyncio/test_queues.py')
-rw-r--r--Lib/test/test_asyncio/test_queues.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/Lib/test/test_asyncio/test_queues.py b/Lib/test/test_asyncio/test_queues.py
index 0a0b529f621..63a9a5f270c 100644
--- a/Lib/test/test_asyncio/test_queues.py
+++ b/Lib/test/test_asyncio/test_queues.py
@@ -273,12 +273,12 @@ class QueueGetTests(_QueueTestBase):
queue._get_loop()
return queue
- q = self.loop.run_until_complete(create_queue())
+ async def test():
+ q = await create_queue()
+ await asyncio.gather(producer(q, producer_num_items),
+ consumer(q, producer_num_items))
- self.loop.run_until_complete(
- asyncio.gather(producer(q, producer_num_items),
- consumer(q, producer_num_items)),
- )
+ self.loop.run_until_complete(test())
def test_cancelled_getters_not_being_held_in_self_getters(self):
def a_generator():
@@ -516,11 +516,14 @@ class QueuePutTests(_QueueTestBase):
for _ in range(num):
item = queue.get_nowait()
- t0 = putter(0)
- t1 = putter(1)
- t2 = putter(2)
- t3 = putter(3)
- self.loop.run_until_complete(asyncio.gather(getter(), t0, t1, t2, t3))
+ async def test():
+ t0 = putter(0)
+ t1 = putter(1)
+ t2 = putter(2)
+ t3 = putter(3)
+ await asyncio.gather(getter(), t0, t1, t2, t3)
+
+ self.loop.run_until_complete(test())
def test_cancelled_puts_not_being_held_in_self_putters(self):
def a_generator():