def skip_because(*args, **kwargs):
 def decorator(f):
  @functools.wraps(f)
  def wrapper(self, *func_args, **func_kwargs):
   skip = False
   if ('condition' in kwargs):
    if (kwargs['condition'] is True):
     skip = True
   else:
    skip = True
   if (('bug' in kwargs) and (skip is True)):
    if (not kwargs['bug'].isdigit()):
     raise ValueError('bug must be a valid bug number')
    msg = ('Skipped until Bug: %s is resolved.' % kwargs['bug'])
    raise testtools.TestCase.skipException(msg)
   return f(self, *func_args, **func_kwargs)
  return wrapper
 return decorator

def skip_because ( * args , ** kwargs ) : def decorator ( f ) : @ functools . wraps ( f ) def wrapper ( self , * func_args , ** func_kwargs ) : skip = False if ( 'condition' in kwargs ) : if ( kwargs [ 'condition' ] is True ) : skip = True else : skip = True if ( ( 'bug' in kwargs ) and ( skip is True ) ) : if ( not kwargs [ 'bug' ] . isdigit ( ) ) : raise ValueError ( 'bug must be a valid bug number' ) msg = ( 'Skipped until Bug: %s is resolved.' % kwargs [ 'bug' ] ) raise testtools . TestCase . skipException ( msg ) return f ( self , * func_args , ** func_kwargs ) return wrapper return decorator
decorator for skipping tests hitting known bugs usage: from openstack_dashboard .