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

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