mainloop_invoke#

pytest_bluezenv.mainloop_invoke(func, *a, **kw)[source]#

Blocking invoke of func in GLib main loop.

Parameters:
  • func (callable) – function to run in the main loop.

  • *a – positional arguments passed to func.

  • **kw – keyword arguments passed to func.

Returns:

the return value of func.

Return type:

object

Raises:

BaseException – any exception raised by func.

Note

GLib main loop is only available for VM host plugins, not in tester.

Example

value = mainloop_invoke(lambda: 123)
assert value == 123

Warning

dbus-python MUST be used only from the GLib main loop, as the library has concurrency bugs. All functions using it MUST either run from GLib main loop eg. via mainloop_wrap