def knownfailureif(fail_condition, msg=None):
 if (msg is None):
  msg = 'Test skipped due to known failure'
 if callable(fail_condition):
  fail_val = (lambda : fail_condition())
 else:
  fail_val = (lambda : fail_condition)
 def knownfail_decorator(f):
  import nose
  def knownfailer(*args, **kwargs):
   if fail_val():
    raise KnownFailureTest(msg)
   else:
    return f(*args, **kwargs)
  return nose.tools.make_decorator(f)(knownfailer)
 return knownfail_decorator

def knownfailureif ( fail_condition , msg = None ) : if ( msg is None ) : msg = 'Test skipped due to known failure' if callable ( fail_condition ) : fail_val = ( lambda : fail_condition ( ) ) else : fail_val = ( lambda : fail_condition ) def knownfail_decorator ( f ) : import nose def knownfailer ( * args , ** kwargs ) : if fail_val ( ) : raise KnownFailureTest ( msg ) else : return f ( * args , ** kwargs ) return nose . tools . make_decorator ( f ) ( knownfailer ) return knownfail_decorator
assume a will fail if *fail_condition* is true .