def skip_if_cache_disabled(*sections):
 def wrapper(f):
  @functools.wraps(f)
  def inner(*args, **kwargs):
   if (not CONF.cache.enabled):
    raise testcase.TestSkipped('Cache globally disabled.')
   for s in sections:
    conf_sec = getattr(CONF, s, None)
    if (conf_sec is not None):
     if (not getattr(conf_sec, 'caching', True)):
      raise testcase.TestSkipped(('%s caching disabled.' % s))
   return f(*args, **kwargs)
  return inner
 return wrapper

def skip_if_cache_disabled ( * sections ) : def wrapper ( f ) : @ functools . wraps ( f ) def inner ( * args , ** kwargs ) : if ( not CONF . cache . enabled ) : raise testcase . TestSkipped ( 'Cache globally disabled.' ) for s in sections : conf_sec = getattr ( CONF , s , None ) if ( conf_sec is not None ) : if ( not getattr ( conf_sec , 'caching' , True ) ) : raise testcase . TestSkipped ( ( '%s caching disabled.' % s ) ) return f ( * args , ** kwargs ) return inner return wrapper
skip a test if caching is disabled .