API Internals#
- class pytest_bluezenv.Call.Proxy#
Upper-tester handle returned as
host.call. Calling it (host.call(...)) invokes a function on the VM host. SeeCall.- __call__(func, *a, **kw)#
Invoke
funcon the VM.- Parameters:
func (
callable) – function to run on the VM.*a – positional arguments to
func.**kw – keyword arguments to
func;sync=Falsereturns aResultProxyinstead of blocking.
- Returns:
the function result, or a
ResultProxywhensync=False.- Return type:
object
- class pytest_bluezenv.Call.ResultProxy(plugin, id_value)#
Handle for a
sync=FalseCall;wait()collects the result once the VM-side call has finished.- wait()#
Wait for and return the result of the asynchronous call.
- Returns:
return value of the VM-host function.
- Return type:
object
- Raises:
RemoteError – the VM-host function raised. It is raised here, when the result is collected, not at call time.
- class pytest_bluezenv.Pexpect.Proxy#
Upper-tester handle returned as
host.pexpect.spawn()starts a process and returns aCtlProxy.
- class pytest_bluezenv.Pexpect.CtlProxy(plugin, ctl_id)#
Handle for one process spawned by
Pexpect.Attribute access dispatches over RPC, giving
send,expect,expect_allandclose. Usable as a context manager (closes on exit). The return values match the VM-side plugin methods.expect()gives an(index, groups)tuple, seeexpect.expect_all()gives a list of matched groups per pattern, seeexpect_all. Both take arejectsequence of patterns aborting the wait.send()gives the number of bytes sent, seesend.close()returns nothing.
- class pytest_bluezenv.rpc.Connection(stream, timeout, name=None)[source]#
Bidirectional message queue on a stream, pickle-based
- call(method, *a, **kw)[source]#
Make RPC method call.
Invokes a corresponding method of the implementation, usually
Implementation.- Parameters:
method (
str) – Method name*a – Arguments passed to method
**kw – Keyword arguments passed to method.
timeout (
float | None) – keyword argument, call timeout if different from default
- Returns:
return value of the method call
- Return type:
object
- Raises:
RemoteError – if remote side threw an exception
RemoteTimeoutError – if call timed out
- call_noreply(method, *a, **kw)[source]#
Make RPC method call with no reply.
Invokes a corresponding method of the implementation, usually
Implementation.- Parameters:
method (
str) – Method name*a – Arguments passed to method
**kw – Keyword arguments passed to method.
timeout (
float | None) – keyword argument, call timeout if different from default
- class pytest_bluezenv.env.Implementation[source]#
VM-side main instance: setup/teardown plugins, plugin RPC server side
- call_plugin(name, method, *a, **kw)[source]#
Call a plugin method
- Parameters:
name (
str) – plugin namemethod (
str) – method name*a – call arguments
**kw – call keyword arguments
- Returns:
plugin method call return value
- Return type:
object
- start_load(plugin)[source]#
Start loading a plugin
- Parameters:
plugin (
HostPlugin) – plugin to load