mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-02-04 08:20:25 +01:00
test: yield the proxy, not the subprocess for the liboeffis fixtures
There's virtually no use for the process, so let's yield the proxy object instead because we can make use of that.
This commit is contained in:
parent
870123f54b
commit
6ce695db3b
1 changed files with 7 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue