The following test only fails on Python 3.10, not on 3.9.
============================= test session starts ==============================
platform linux -- Python 3.10.1, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /build/source
collected 150 items
tests/test_cli.py . [ 0%]
tests/test_parse.py .................................................... [ 35%]
........................................................................ [ 83%]
.......... [ 90%]
tests/test_protocol.py .............. [ 99%]
tests/test_proxy.py F [100%]
=================================== FAILURES ===================================
_________________________________ test_spawns __________________________________
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffff5fa6080>
def test_spawns(monkeypatch):
"""At least test if the CLI doesn't error on load."""
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
# setup task to stop CLI loop
@asyncio.coroutine
def stop():
"""Wait and close loop."""
yield from asyncio.sleep(0.1)
loop.stop()
if hasattr(asyncio, "ensure_future"):
ensure_future = asyncio.ensure_future
else: # Deprecated since Python 3.4.4
ensure_future = getattr(asyncio, "async")
ensure_future(stop(), loop=loop)
# use simulation interface
args = ["--port", "loop://", "-v"]
# patch to make 'loop://' work with serial_asyncio
monkeypatch.setattr(SerialTransport, "_ensure_reader", lambda self: True)
# test calling results in the loop close cleanly
> assert main(args, loop=loop) is None
tests/test_proxy.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
rflinkproxy/__main__.py:309: in main
server = loop.run_until_complete(server_coro)
/nix/store/b798fp24zf2fdafmyyc4sxfr48ly5yy9-python3-3.10.1/lib/python3.10/asyncio/base_events.py:641: in run_until_complete
return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
client_connected_cb = <bound method RFLinkProxy.client_connected_callback of <rflinkproxy.__main__.RFLinkProxy object at 0x7ffff5fa5660>>
host = '', port = '1337', limit = 65536
kwds = {'loop': <_UnixSelectorEventLoop running=False closed=False debug=False>}
factory = <function start_server.<locals>.factory at 0x7ffff5dc5d80>
async def start_server(client_connected_cb, host=None, port=None, *,
limit=_DEFAULT_LIMIT, **kwds):
"""Start a socket server, call back for each client connected.
The first parameter, `client_connected_cb`, takes two parameters:
client_reader, client_writer. client_reader is a StreamReader
object, while client_writer is a StreamWriter object. This
parameter can either be a plain callback function or a coroutine;
if it is a coroutine, it will be automatically converted into a
Task.
The rest of the arguments are all the usual arguments to
loop.create_server() except protocol_factory; most common are
positional host and port, with various optional keyword arguments
following. The return value is the same as loop.create_server().
Additional optional keyword arguments are loop (to set the event loop
instance to use) and limit (to set the buffer limit passed to the
StreamReader).
The return value is the same as loop.create_server(), i.e. a
Server object which can be used to stop the service.
"""
loop = events.get_running_loop()
def factory():
reader = StreamReader(limit=limit, loop=loop)
protocol = StreamReaderProtocol(reader, client_connected_cb,
loop=loop)
return protocol
> return await loop.create_server(factory, host, port, **kwds)
E TypeError: BaseEventLoop.create_server() got an unexpected keyword argument 'loop'
/nix/store/b798fp24zf2fdafmyyc4sxfr48ly5yy9-python3-3.10.1/lib/python3.10/asyncio/streams.py:84: TypeError
=============================== warnings summary ===============================
rflink/protocol.py:244
/build/source/rflink/protocol.py:244: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
def send_command_ack(
rflinkproxy/__main__.py:128
/build/source/rflinkproxy/__main__.py:128: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
def handle_raw_tx_packet(self, writer, raw_packet):
rflinkproxy/__main__.py:161
/build/source/rflinkproxy/__main__.py:161: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
def forward_packet(self, writer, packet, raw_packet):
rflinkproxy/__main__.py:177
/build/source/rflinkproxy/__main__.py:177: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
def client_connected_callback(self, reader, writer):
rflinkproxy/__main__.py:232
/build/source/rflinkproxy/__main__.py:232: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
def connect(self):
tests/test_cli.py::test_spawns
/build/source/tests/test_cli.py:17: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
def stop():
tests/test_protocol.py: 14 warnings
/build/source/rflink/protocol.py:68: DeprecationWarning: There is no current event loop
self.loop = asyncio.get_event_loop()
tests/test_proxy.py::test_spawns
/build/source/tests/test_proxy.py:17: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
def stop():
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED tests/test_proxy.py::test_spawns - TypeError: BaseEventLoop.create_ser...
================== 1 failed, 149 passed, 21 warnings in 0.95s ==================
The following test only fails on Python 3.10, not on 3.9.