def load_known_checks(self): load_checks() known_checks = {} for cls in OpenShiftCheck.subclasses(): check_name = cls.name if check_name in known_checks: other_cls = known_checks[check_name].__class__ raise OpenShiftCheckException( "non-unique check name '{}' in: '{}.{}' and '{}.{}'". format(check_name, cls.__module__, cls.__name__, other_cls.__module__, other_cls.__name__)) known_checks[check_name] = cls(execute_module=self._execute_module) return known_checks
def load_known_checks(self): load_checks() known_checks = {} for cls in OpenShiftCheck.subclasses(): check_name = cls.name if check_name in known_checks: other_cls = known_checks[check_name].__class__ raise OpenShiftCheckException( "non-unique check name '{}' in: '{}.{}' and '{}.{}'".format( check_name, cls.__module__, cls.__name__, other_cls.__module__, other_cls.__name__)) known_checks[check_name] = cls(execute_module=self._execute_module) return known_checks
def load_known_checks(self, tmp, task_vars): """Find all existing checks and return a mapping of names to instances.""" load_checks() known_checks = {} for cls in OpenShiftCheck.subclasses(): name = cls.name if name in known_checks: other_cls = known_checks[name].__class__ raise OpenShiftCheckException( "duplicate check name '{}' in: '{}' and '{}'" "".format(name, full_class_name(cls), full_class_name(other_cls)) ) known_checks[name] = cls(execute_module=self._execute_module, tmp=tmp, task_vars=task_vars) return known_checks
def test_load_checks(): """Loading checks should load and return Python modules.""" modules = load_checks() assert modules
def test_load_checks(): """Loading checks should load and return Python modules.""" modules = load_checks() assert modules