@pytest.fixture(scope='module', params=['gpu', 'cpu'])
def backend_default(request):
 be = get_backend(request)
 def cleanup():
  be = request.getfuncargvalue('backend_default')
  del be
 request.addfinalizer(cleanup)
 return be

@ pytest . fixture ( scope = 'module' , params = [ 'gpu' , 'cpu' ] ) def backend_default ( request ) : be = get_backend ( request ) def cleanup ( ) : be = request . getfuncargvalue ( 'backend_default' ) del be request . addfinalizer ( cleanup ) return be
fixture to setup the backend before running a test .