From a43c73597856125bd8f9b79227df0666df6ecde5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Gotl=C3=A9n?= Date: Tue, 11 Jul 2023 11:31:26 +0200 Subject: [PATCH] Fixed warning from sending coroutines to asyncio.wait --- test/qtmprotocol_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/qtmprotocol_test.py b/test/qtmprotocol_test.py index ea9ee2f..5cd2497 100644 --- a/test/qtmprotocol_test.py +++ b/test/qtmprotocol_test.py @@ -65,14 +65,15 @@ async def test_await_event_multiple(event_loop, qtmprotocol: QTMProtocol): @pytest.mark.asyncio async def test_await_multiple(qtmprotocol: QTMProtocol): - awaitable1 = qtmprotocol.await_event(event=QRTEvent.EventConnected) - awaitable2 = qtmprotocol.await_event(event=QRTEvent.EventConnectionClosed) + loop = asyncio.get_event_loop() + awaitable1 = loop.create_task(qtmprotocol.await_event(event=QRTEvent.EventConnected)) + awaitable2 = loop.create_task(qtmprotocol.await_event(event=QRTEvent.EventConnectionClosed)) done, _ = await asyncio.wait( [awaitable1, awaitable2], return_when=asyncio.FIRST_EXCEPTION ) print(done) - + with pytest.raises(Exception): done.pop().result()