Commit c072e788 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

qa_config: Support callable test checks

Until now all tests depended on simple AND/OR conditions. With the
introduction of virtual cluster support, some tests can only run if
virtual clusters are not in use (e.g. not yet supported or not
possible). Instead of introducing more logic for enabling/disabling
tests, callable values are supported instead. “ht.WithDesc” should be
used on them to continue to provide a readable description.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarBernardo Dal Seno <>
parent 76fda900
......@@ -108,6 +108,7 @@ def RunTestIf(testnames, fn, *args, **kwargs):
tstart =
desc = _DescriptionOf(fn)
# TODO: Formatting test names when non-string names are involved
print _FormatHeader("%s skipping %s, test(s) %s disabled" %
(tstart, desc, testnames))
......@@ -475,6 +475,8 @@ def _TestEnabledInner(check_fn, names, fn):
value = _TestEnabledInner(check_fn, name.tests, compat.any)
elif isinstance(name, (list, tuple)):
value = _TestEnabledInner(check_fn, name, compat.all)
elif callable(name):
value = name()
value = check_fn(name)
......@@ -142,6 +142,12 @@ class TestTestEnabled(unittest.TestCase):
def testCallable(self):
self.assertTrue(qa_config.TestEnabled([lambda: True], _cfg={}))
for value in [None, False, "", 0]:
self.assertFalse(qa_config.TestEnabled(lambda: value, _cfg={}))
class TestQaConfigLoad(unittest.TestCase):
def setUp(self):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment