qbench.testing module#

Module implementing several test utilities and mocks.

class qbench.testing.MockProvider#

Provider for obtaining instances of MockSimulator.

backends(name=None, **kwargs)#

Get list of all backends obtainable by this provider.

Unsurprisingly, the list comprises only and instance of MockSimulator. However, it is always the same instance. That way, we are able to retrieve the cached jobs.

Return type:


static reset_caches()#

Reset caches thus allowing for construction of new Mock simulators.

This is stateful and ugly, but mock simulators need to be stateful so that we can simulate retrieval

class qbench.testing.MockSimulator(fail_job_indices=None, name='mock-backend', job_wrappers=None, *args, **kwargs)#

Local mock simulator adhering to the BackendV2 interface, but caching all jobs it executes.

This class is a wrapper around AerSimulator, so in particular all the initializer arguments are the same as for AerSimulator.


Return name of this backend.


Retrieve job of given ID.


job_id (str) –

Return type:


run(*args, **kwargs)#

Run given circuit and return corresponding job.