How to use the kibitzr.conf.ConfigurationError function in kibitzr

To help you get started, we’ve selected a few kibitzr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kibitzr / kibitzr / tests / unit / test_conf.py View on Github external
def test_missing_config_raises_configuration_error(exists):
    with pytest.raises(ConfigurationError):
        settings()
github kibitzr / kibitzr / kibitzr / conf.py View on Github external
def detect_config_dir(cls):
        candidates = [
            (directory, os.path.join(directory, cls.CONFIG_FILENAME))
            for directory in map(os.path.expanduser, cls.CONFIG_DIRS)
        ]
        for directory, file_path in candidates:
            if os.path.exists(file_path):
                return directory
        raise ConfigurationError(
            "kibitzr.yml not found in following locations: %s"
            % ", ".join([x[1] for x in candidates])
        )
github kibitzr / kibitzr / kibitzr / conf.py View on Github external
def unpack_templates(checks, templates):
        for check in checks:
            if 'template' in check:
                if check['template'] in templates:
                    templated_check = dict(
                        copy.deepcopy(templates[check['template']]),
                        **check
                    )
                    del templated_check['template']
                    yield templated_check
                else:
                    raise ConfigurationError(
                        "Template %r not found. Referenced in check %r"
                        % (check['template'], check['name'])
                    )
            else:
                yield check