EventPluginMixin#

class pytest_bluezenv.EventPluginMixin[source]#

Simple expect() / reply() pattern for handling async events in host plugins.

Mix it into a HostPlugin, call EventPluginMixin.setup from the plugin’s setup, and push Event instances to self.events. The upper tester then drives them with expect and reply. Answer an incoming call with reply. Await an outgoing one by expecting its :reply or :error kind and reading the outcome from the event, as in object_method.

Example

class MyPlugin(HostPlugin, EventPluginMixin):
    def setup(self, impl):
        EventPluginMixin.setup(self, impl)

event = host.myplugin.expect("org.example.Method")
host.myplugin.reply("return value")
events#

pending Event instances. Custom D-Bus methods push events here for expect() to pick up. Set by setup.

Type:

queue.SimpleQueue

__init__()#

Methods

expect(kinds)

Get most recent pending Event and assert its kind.

get_event([block])

Get most recent pending Event, blocking optional.

object_method(obj, method, *a, **kw)

Call DBus method of an object and handle reply as async events.

reply(*value)

Provide a D-Bus reply to the most recent pending event.

reply_error([err])

Provide a D-Bus error reply to the most recent pending event.

setup(impl)

Initialise the event queue.