altdesktop / python-dbus-next

🚌 The next great DBus library for Python with asyncio support
https://python-dbus-next.readthedocs.io/en/latest/
MIT License
191 stars 60 forks source link

Mark integration tests #95

Open dvzrv opened 3 years ago

dvzrv commented 3 years ago

Hi! When packaging 0.2.2 for Arch Linux and running the pytest suite against the project, I ran into the issue, that some of the tests assume a functioning dbus (i.e. integration tests). However, as we build in pristine systemd-nspawn containers there is no (running) dbus or graphical session.

Full pytest log: python-dbus-next-0.2.2-build.log

Would it be possible to mark the integration tests using pytest.mark? This way they could be easily ignored using e.g. pytest -m "not integration").

I currently use the following to select the tests that I am not able to run:

  pytest -v \
    --ignore "test/test_aio_low_level.py" \
    --ignore "test/test_big_message.py" \
    --ignore "test/test_disconnect.py" \
    --ignore "test/test_request_name.py" \
    --ignore "test/test_tcp_address.py" \
    --ignore "test/client/test_methods.py" \
    --ignore "test/client/test_properties.py" \
    --ignore "test/client/test_signals.py" \
    --ignore "test/service/test_export.py" \
    --ignore "test/service/test_methods.py" \
    --ignore "test/service/test_properties.py" \
    --ignore "test/service/test_signals.py" \
    --ignore "test/service/test_standard_interfaces.py" \
    -k "not test_sending_file_descriptor_low_level and not test_high_level_service_fd_passing and not test_sending_file_descriptor_with_proxy"
acrisci commented 3 years ago

Yeah that sounds good.

alebastr commented 3 years ago

@dvzrv, have you tried running test suite with dbus-run-session -- pytest? The command works for my Fedora package and our build environment is also based on systemd-nspawn containers.

dvzrv commented 3 years ago

@alebastr many thanks! That fixes it for me :)

I'm not very used to using dbus in the build environment, but it works with dbus-run-session -- pytest -v.