Merge "Fix the docstring of skip_unless_config()"

This commit is contained in:
Jenkins 2016-05-09 17:10:36 +00:00 committed by Gerrit Code Review
commit 6b690736c2

View File

@ -1390,7 +1390,7 @@ CONF = TempestConfigProxy()
def skip_unless_config(*args):
"""Decorator to raise a skip if a config opt doesn't exist and is False
"""Decorator to raise a skip if a config opt doesn't exist or is False
:param str group: The first arg, the option group to check
:param str name: The second arg, the option name to check
@ -1407,21 +1407,21 @@ def skip_unless_config(*args):
if not hasattr(CONF, group):
msg = "Config group %s doesn't exist" % group
raise testtools.TestCase.skipException(msg)
else:
conf_group = getattr(CONF, group)
if not hasattr(conf_group, name):
msg = "Config option %s.%s doesn't exist" % (group,
name)
raise testtools.TestCase.skipException(msg)
conf_group = getattr(CONF, group)
if not hasattr(conf_group, name):
msg = "Config option %s.%s doesn't exist" % (group,
name)
raise testtools.TestCase.skipException(msg)
value = getattr(conf_group, name)
if not value:
if len(args) == 3:
msg = args[2]
else:
value = getattr(conf_group, name)
if not value:
if len(args) == 3:
msg = args[2]
else:
msg = "Config option %s.%s is false" % (group,
name)
raise testtools.TestCase.skipException(msg)
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