def stubout_create_vm(stubs):
 def f(*args):
  raise XenAPI.Failure('Test Exception raised by fake create_vm')
 stubs.Set(vm_utils, 'create_vm', f)

def stubout_create_vm ( stubs ) : def f ( * args ) : raise XenAPI . Failure ( 'Test Exception raised by fake create_vm' ) stubs . Set ( vm_utils , 'create_vm' , f )
simulates a failure in create_vm .