Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def it_explodes_on_ambiguity(self, tmpdir):
conffile = tmpdir.join('example1.ini')
conffile.write(example1.ini)
conffile = tmpdir.join('example1.conf')
conffile.write(example1.ini)
with ShouldRaise(
C.AmbiguousConfig(
S(r'multiple configurations found at .*/example1\.\*'))
):
example1.config.from_path_prefix(tmpdir.strpath + '/')
def from_glob(self, pattern):
from pgctl.configsearch import glob
results = []
for fname in glob(pattern):
try:
config = self.from_file(fname)
except UnrecognizedConfig:
continue
else:
results.append(config)
if len(results) == 1:
return results[0]
elif len(results) > 1:
raise AmbiguousConfig('multiple configurations found at %s' % pattern)