def skip_if_config(*args):
 def decorator(f):
  group = args[0]
  name = args[1]
  @functools.wraps(f)
  def wrapper(self, *func_args, **func_kwargs):
   if hasattr(CONF, group):
    conf_group = getattr(CONF, group)
    if hasattr(conf_group, name):
     value = getattr(conf_group, name)
     if value:
      if (len(args) == 3):
       msg = args[2]
      else:
       msg = ('Config option %s.%s is false' % (group, name))
      raise testtools.TestCase.skipException(msg)
   return f(self, *func_args, **func_kwargs)
  return wrapper
 return decorator

def skip_if_config ( * args ) : def decorator ( f ) : group = args [ 0 ] name = args [ 1 ] @ functools . wraps ( f ) def wrapper ( self , * func_args , ** func_kwargs ) : if hasattr ( CONF , group ) : conf_group = getattr ( CONF , group ) if hasattr ( conf_group , name ) : value = getattr ( conf_group , name ) if value : if ( len ( args ) == 3 ) : msg = args [ 2 ] else : msg = ( 'Config option %s.%s is false' % ( group , name ) ) raise testtools . TestCase . skipException ( msg ) return f ( self , * func_args , ** func_kwargs ) return wrapper return decorator
raise a skipexception if a config exists and is true .