Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest test faile because pytest-asyncio mode default to strict #314

Open
kwibus opened this issue Jul 30, 2023 · 0 comments
Open

pytest test faile because pytest-asyncio mode default to strict #314

kwibus opened this issue Jul 30, 2023 · 0 comments
Assignees
Labels

Comments

@kwibus
Copy link

kwibus commented Jul 30, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants