Skip to content

test: rework the oeffis dbus tests to be pytest-compatible

Peter Hutterer requested to merge whot/libei:wip/pytest into main

DBusMock is unittest based and the documentation points users to that approach. That approach is limiting however because we can't use all pytest features (see [1]). Luckily, the parent class in dbusmock doesn't really do much so we can emulate the functionality ourselves - all we need to do is call the same setUp/tearDowns and be done with it.

This means we can move the dbus-monitor and mainloop handling into fixtures too which makes the code a fair bit nicer to read.

[1] https://docs.pytest.org/en/7.1.x/how-to/unittest.html#pytest-features-in-unittest-testcase-subclasses


cc @martin - this was the easiest one I found to switch to the pytest approach but it should be fully compatible with all pytest features now, fixtures and parametrization.

Merge request reports