mainloop_assert#

pytest_bluezenv.mainloop_assert(func)[source]#

Wrap function to assert it runs from GLib main loop

Parameters:

func (callable) – function to wrap.

Returns:

wrapper that raises if not called from the main loop.

Return type:

callable

Note

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

Example

@mainloop_assert
def func():
    bus = get_dbus()