diff --git a/test/test_oeffis.py b/test/test_oeffis.py index 6eeefc5..b4cd883 100644 --- a/test/test_oeffis.py +++ b/test/test_oeffis.py @@ -53,6 +53,7 @@ from dbus.mainloop.glib import DBusGMainLoop import attr import ctypes import dbus +import dbus.proxies import dbusmock import fcntl import os @@ -317,11 +318,12 @@ def session_bus(session_bus_unmonitored) -> Iterator[dbusmock.DBusTestCase]: @pytest.fixture() -def daemon( +def mock( session_bus, portal_name="RemoteDesktop", params=None, extra_templates=[] -) -> Iterator[subprocess.Popen]: +) -> Iterator[dbus.proxies.ProxyObject]: """ - Fixture that starts a DBusMock daemon in a separate process. + Fixture that starts a DBusMock daemon in a separate process and returns + the ProxyObject for the mock. If extra_templates is specified, it is a list of tuples with the portal name as first value and the param dict to be passed to that @@ -344,7 +346,7 @@ def daemon( dbus_interface=dbusmock.MOCK_IFACE, ) - yield p_mock + yield obj_portal if p_mock.stdout: out = (p_mock.stdout.read() or b"").decode("utf-8") @@ -379,7 +381,7 @@ class TestOeffis: Test class that sets up a mocked DBus session bus to be used by liboeffis.so. """ - def test_create_session(self, daemon, mainloop): + def test_create_session(self, mock, mainloop): oeffis = Oeffis() oeffis.create_session(oeffis.DEVICE_POINTER | oeffis.DEVICE_KEYBOARD) # type: ignore oeffis.dispatch() # type: ignore