JeffLIrion / adb_shell

A Python implementation of ADB with shell and FileSync functionality.
Apache License 2.0
530 stars 60 forks source link

Test failures with Python 3.10 #198

Closed fabaff closed 2 years ago

fabaff commented 2 years ago

Description

With Python 3.10 approx. 70 tests fails.

Log

ecuting pytestCheckPhase
============================= 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 176 items                                                            

tests/test_adb_device.py ............................................... [ 26%]
.............                                                            [ 34%]
tests/test_adb_device_async.py FFFFFFFFFFFFFFFFFFF.FFFFFFFFFFFFFFFFFFFFF [ 57%]
FFFFFFFFFFFFFFFFFFF                                                      [ 68%]
tests/test_adb_message.py .....                                          [ 71%]
tests/test_exceptions.py ................                                [ 80%]
tests/test_hidden_helpers.py .........                                   [ 85%]
tests/test_keygen.py .                                                   [ 85%]
tests/test_sign_cryptography.py ..                                       [ 86%]
tests/test_sign_pycryptodome.py ..                                       [ 88%]
tests/test_sign_pythonrsa.py ....                                        [ 90%]
tests/test_tcp_transport.py ....                                         [ 92%]
tests/test_tcp_transport_async.py FFFFFFFF                               [ 97%]
tests/test_usb_importerror.py ..                                         [ 98%]
tests/test_usb_transport.py ...                                          [100%]

=================================== FAILURES ===================================
_________________ TestAdbDeviceAsync.test_adb_connection_error _________________

args = (<tests.test_adb_device_async.TestAdbDeviceAsync testMethod=test_adb_connection_error>,)
kwargs = {}

    def sync_func(*args, **kwargs):
>       return _await(func(*args, **kwargs))

tests/async_wrapper.py:18: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

coro = <coroutine object TestAdbDeviceAsync.test_adb_connection_error at 0x7ffff4d06260>

    def _await(coro):
        with warnings.catch_warnings(record=True) as warns:
            ret = asyncio.get_event_loop().run_until_complete(coro)

            if warns:
>               raise RuntimeError
E               RuntimeError

tests/async_wrapper.py:11: RuntimeError
______________________ TestAdbDeviceAsync.test_available _______________________

args = (<tests.test_adb_device_async.TestAdbDeviceAsync testMethod=test_available>,)
kwargs = {}

    def sync_func(*args, **kwargs):
>       return _await(func(*args, **kwargs))

tests/async_wrapper.py:18: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

coro = <coroutine object TestAdbDeviceAsync.test_available at 0x7ffff4d068f0>

    def _await(coro):
        with warnings.catch_warnings(record=True) as warns:
            ret = asyncio.get_event_loop().run_until_complete(coro)

            if warns:
>               raise RuntimeError
E               RuntimeError

tests/async_wrapper.py:11: RuntimeError
________________________ TestAdbDeviceAsync.test_close _________________________

args = (<tests.test_adb_device_async.TestAdbDeviceAsync testMethod=test_close>,)
kwargs = {}

    def sync_func(*args, **kwargs):
>       return _await(func(*args, **kwargs))

tests/async_wrapper.py:18: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

coro = <coroutine object TestAdbDeviceAsync.test_close at 0x7ffff4d06dc0>

    def _await(coro):
        with warnings.catch_warnings(record=True) as warns:
            ret = asyncio.get_event_loop().run_until_complete(coro)

            if warns:
>               raise RuntimeError
E               RuntimeError

tests/async_wrapper.py:11: RuntimeError
_______________________ TestAdbDeviceAsync.test_connect ________________________

args = (<tests.test_adb_device_async.TestAdbDeviceAsync testMethod=test_connect>,)
kwargs = {}

    def sync_func(*args, **kwargs):
>       return _await(func(*args, **kwargs))

tests/async_wrapper.py:18: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

coro = <coroutine object TestAdbDeviceAsync.test_connect at 0x7ffff4d07290>

    def _await(coro):
        with warnings.catch_warnings(record=True) as warns:
            ret = asyncio.get_event_loop().run_until_complete(coro)

            if warns:
>               raise RuntimeError
E               RuntimeError

tests/async_wrapper.py:11: RuntimeError
----------------------------- Captured stdout call -----------------------------
bulk_write(24): b'CNXN\x00\x00\x00\x01\x00\x00\x10\x00\x10\x00\x00\x00\xfb\x05\x00\x00\xbc\xb1\xa7\xb1'
bulk_write(16): b'host::localhost\x00'
bulk_read(24): b'CNXN\x01\x00\x00\x00\x00\x10\x00\x00\x0e\x00\x00\x00B\x05\x00\x00\xbc\xb1\xa7\xb1'
bulk_read(14): b'host::unknown\x00'
------------------------------ Captured log call -------------------------------
DEBUG    adb_shell.adb_device_async:adb_device_async.py:484 bulk_write(24): b'CNXN\x00\x00\x00\x01\x00\x00\x10\x00\x10\x00\x00\x00\xfb\x05\x00\x00\xbc\xb1\xa7\xb1'
DEBUG    adb_shell.adb_device_async:adb_device_async.py:488 bulk_write(16): b'host::localhost\x00'
DEBUG    adb_shell.adb_device_async:adb_device_async.py:410 bulk_read(24): b'CNXN\x01\x00\x00\x00\x00\x10\x00\x00\x0e\x00\x00\x00B\x05\x00\x00\xbc\xb1\xa7\xb1'
DEBUG    adb_shell.adb_device_async:adb_device_async.py:410 bulk_read(14): b'host::unknown\x00'
___________________ TestAdbDeviceAsync.test_connect_no_keys ____________________
[...]
coro = <coroutine object TestTcpTransportAsync.test_connect_with_timeout at 0x7ffff4415460>

    def _await(coro):
        with warnings.catch_warnings(record=True) as warns:
            ret = asyncio.get_event_loop().run_until_complete(coro)

            if warns:
>               raise RuntimeError
E               RuntimeError

tests/async_wrapper.py:11: RuntimeError
=========================== short test summary info ============================
FAILED tests/test_adb_device_async.py::TestAdbDeviceAsync::test_adb_connection_error
FAILED tests/test_adb_device_async.py::TestAdbDeviceAsync::test_available - R...
FAILED tests/test_adb_device_async.py::TestAdbDeviceAsync::test_close - Runti...
FAILED tests/test_adb_device_async.py::TestAdbDeviceAsync::test_connect - Run...
FAILED tests/test_adb_device_async.py::TestAdbDeviceAsync::test_connect_no_keys
FAILED tests/test_adb_device_async.py::TestAdbDeviceAsync::test_connect_timeout
[...]
FAILED tests/test_tcp_transport_async.py::TestTcpTransportAsync::test_connect
FAILED tests/test_tcp_transport_async.py::TestTcpTransportAsync::test_connect_close
FAILED tests/test_tcp_transport_async.py::TestTcpTransportAsync::test_connect_close_catch_oserror
FAILED tests/test_tcp_transport_async.py::TestTcpTransportAsync::test_connect_with_timeout
======================== 67 failed, 109 passed in 6.74s ========================

At first glance I would say that this is related to the removal of loop in Python 3.10.

JeffLIrion commented 2 years ago

Thanks for pointing me in the right direction!