Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_missing_config_raises_configuration_error(exists):
with pytest.raises(ConfigurationError):
settings()
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])
)
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