playerctl
playerctl copied to clipboard
pytest test faile because pytest-asyncio mode default to strict
The pytest complains about:
/usr/lib/python3/dist-packages/pygments/lexer.py:48: RuntimeWarning: coroutine 'bus_address' was never awaited
This can be fixed by adding.
# pytest.ini
[pytest]
asyncio_mode = auto
or replace @pytest.fixture() with @pytest_asyncio.fixture in test/conftest.py
steps to reproduce.
When on the master branch run:
make docker-test
....
...
docker run -it playerctl-test
===================================================================================== test session starts =====================================================================================
platform linux -- Python 3.8.10, pytest-7.4.0, pluggy-1.2.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /app
configfile: pytest.ini
plugins: timeout-2.1.0, asyncio-0.21.1
timeout:
timeout method: signal
timeout func_only: False
asyncio: mode=strict
collected 18 items
test/test_basics.py::test_basics PASSED
test/test_basics.py::test_list_names FAILED
test/test_basics.py::test_system_list_players FAILED
test/test_basics.py::test_queries FAILED
test/test_commands.py::test_commands FAILED
test/test_daemon.py::test_daemon_commands FAILED
test/test_daemon.py::test_daemon_follow FAILED
test/test_daemon.py::test_daemon_shift_simple FAILED
test/test_daemon.py::test_daemon_shift_no_player FAILED
test/test_daemon.py::test_active_player_change FAILED
test/test_follow.py::test_follow FAILED
test/test_follow.py::test_follow_selection FAILED
test/test_follow.py::test_follow_selection_any FAILED
test/test_follow.py::test_follow_all_players FAILED
test/test_format.py::test_emoji FAILED
test/test_format.py::test_format FAILED
test/test_selection.py::test_selection FAILED
test/test_selection.py::test_daemon_selection FAILED
========================================================================================== FAILURES ===========================================================================================
_______________________________________________________________________________________ test_list_names _______________________________________________________________________________________
bus_address = <coroutine object bus_address at 0x7f538ec7d4c0>
/usr/lib/python3/dist-packages/pygments/lexer.py:48: RuntimeWarning: coroutine 'bus_address' was never awaited
return type.__new__(mcs, name, bases, d)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
@pytest.mark.asyncio
async def test_list_names(bus_address):
> mpris_players = await setup_mpris('basics1',
'basics2',
'basics3',
bus_address=bus_address)
test/test_basics.py:44:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/mpris.py:24: in setup_mpris
players = await asyncio.gather(*(setup(name) for name in names))
test/mpris.py:15: in setup
bus = await MessageBus(bus_type=bus_type,
/usr/local/lib/python3.8/dist-packages/dbus_next/aio/message_bus.py:122: in __init__
super().__init__(bus_address, bus_type, ProxyObject)
/usr/local/lib/python3.8/dist-packages/dbus_next/message_bus.py:71: in __init__
self._bus_address = parse_address(bus_address) if bus_address else parse_address(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
address_str = <coroutine object bus_address at 0x7f538ec7d4c0>
def parse_address(address_str):
addresses = []
> for address in filter(lambda a: a, address_str.split(';')):
E AttributeError: 'coroutine' object has no attribute 'split'
/usr/local/lib/python3.8/dist-packages/dbus_next/_private/address.py:14: AttributeError
...
...
full output output.txt