EventPluginMixin#
- class pytest_bluezenv.EventPluginMixin[source]#
Simple
expect()/reply()pattern for handling async events in host plugins.Mix it into a
HostPlugin, callEventPluginMixin.setupfrom the plugin’ssetup, and pushEventinstances toself.events. The upper tester then drives them withexpectandreply. Answer an incoming call withreply. Await an outgoing one by expecting its:replyor:errorkind and reading the outcome from the event, as inobject_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
Eventinstances. Custom D-Bus methods push events here forexpect()to pick up. Set bysetup.- 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.