def _check_require(group, feature, test_method): features_group = getattr(config.CONF, group, None) if not features_group: return test_method feature_enabled = features_group.get(feature, True) skipper = testtools.skipUnless(feature_enabled, "%s - Feature not enabled." % feature) return skipper(test_method)
def requires_convergence(test_method): '''Decorator for convergence-only tests. The decorated test will be skipped when convergence is disabled. ''' convergence_enabled = config.CONF.heat_plugin.convergence_engine_enabled skipper = testtools.skipUnless(convergence_enabled, "Convergence-only tests are disabled") return skipper(test_method)
def decorator(test_method): conf = getattr(config.CONF, 'heat_plugin', None) if not conf or conf.auth_url is None: return test_method global _resource_types if not _resource_types: manager = clients.ClientManager(conf) obj_rtypes = manager.orchestration_client.resource_types.list() _resource_types = list(t.resource_type for t in obj_rtypes) rtype_available = resource_type and resource_type in _resource_types skipper = testtools.skipUnless( rtype_available, "%s resource type not available, skipping test." % resource_type) return skipper(test_method)
def requires_py3(testcase): return testtools.skipUnless(six.PY3, "requires python 3.x")(testcase)
def requires_py2(testcase): return testtools.skipUnless(six.PY2, "requires python 2.x")(testcase)