def skip_on_not_implemented(only_if=None):
 def decorator(fun):
  @functools.wraps(fun)
  def wrapper(*args, **kwargs):
   try:
    return fun(*args, **kwargs)
   except NotImplementedError:
    if (only_if is not None):
     if (not only_if):
      raise
    msg = ('%r was skipped because it raised NotImplementedError' % fun.__name__)
    raise unittest.SkipTest(msg)
  return wrapper
 return decorator

def skip_on_not_implemented ( only_if = None ) : def decorator ( fun ) : @ functools . wraps ( fun ) def wrapper ( * args , ** kwargs ) : try : return fun ( * args , ** kwargs ) except NotImplementedError : if ( only_if is not None ) : if ( not only_if ) : raise msg = ( '%r was skipped because it raised NotImplementedError' % fun . __name__ ) raise unittest . SkipTest ( msg ) return wrapper return decorator
decorator to ignore notimplementederror exceptions .