Skip to content

Commit

Permalink
Merge pull request #33 from qualisys/fix_test_warning
Browse files Browse the repository at this point in the history
Fixed warning from sending coroutines to asyncio.wait
  • Loading branch information
qjgn authored Jul 11, 2023
2 parents 069b4af + a43c735 commit 10930b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/qtmprotocol_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 10930b1

Please sign in to comment.