RuntimeError with closed event loop
This happens when running tests (i.e. via poetry run pytest
):
===================================================================== 1 passed, 3 skipped in 0.30 seconds ======================================================================
Task was destroyed but it is pending!
task: <Task pending coro=<WebSocketCommonProtocol.transfer_data() running at /home/rigelk/.cache/pypoetry/virtualenvs/dat-daemon-pyclient-py3.7/lib/python3.7/site-packages/websockets/protocol.py:674> wait_for=<Future finished result=None> cb=[<TaskWakeupMethWrapper object at 0x7f645b304318>()]>
Task was destroyed but it is pending!
task: <Task pending coro=<WebSocketCommonProtocol.keepalive_ping() running at /home/rigelk/.cache/pypoetry/virtualenvs/dat-daemon-pyclient-py3.7/lib/python3.7/site-packages/websockets/protocol.py:977> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f645b3042b8>()]>>
Task was destroyed but it is pending!
task: <Task pending coro=<WebSocketCommonProtocol.close_connection() running at /home/rigelk/.cache/pypoetry/virtualenvs/dat-daemon-pyclient-py3.7/lib/python3.7/site-packages/websockets/protocol.py:1019> wait_for=<Task pending coro=<WebSocketCommonProtocol.transfer_data() running at /home/rigelk/.cache/pypoetry/virtualenvs/dat-daemon-pyclient-py3.7/lib/python3.7/site-packages/websockets/protocol.py:674> wait_for=<Future finished result=None> cb=[<TaskWakeupMethWrapper object at 0x7f645b304318>()]>>
Exception ignored in: <generator object WebSocketCommonProtocol.close_connection at 0x7f645b325d68>
Traceback (most recent call last):
File "/home/rigelk/.cache/pypoetry/virtualenvs/dat-daemon-pyclient-py3.7/lib/python3.7/site-packages/websockets/protocol.py", line 1054, in close_connection
self.writer.close()
File "/usr/lib/python3.7/asyncio/streams.py", line 317, in close
return self._transport.close()
File "/usr/lib/python3.7/asyncio/selector_events.py", line 650, in close
self._loop.call_soon(self._call_connection_lost, None)
File "/usr/lib/python3.7/asyncio/base_events.py", line 688, in call_soon
self._check_closed()
File "/usr/lib/python3.7/asyncio/base_events.py", line 480, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed