Merge "Handle empty config files"
This commit is contained in:
commit
9410229b83
@ -234,7 +234,8 @@ class Config(object):
|
||||
except IOError as err:
|
||||
self._report_failure_config_file(filename, err)
|
||||
else:
|
||||
self.override(**self._contents)
|
||||
if self._contents:
|
||||
self.override(**self._contents)
|
||||
|
||||
def _report_missing_config_files(self, filenames):
|
||||
# NOTE(dhellmann): This is extracted so we can mock it for
|
||||
|
@ -94,6 +94,14 @@ collapse_pre_releases: false
|
||||
config_path = self.tempdir.join('reno.yaml')
|
||||
self._test_load_file(config_path)
|
||||
|
||||
def test_load_file_empty(self):
|
||||
config_path = self.tempdir.join('reno.yaml')
|
||||
with open(config_path, 'w') as fd:
|
||||
fd.write('# Add reno config here')
|
||||
self.addCleanup(os.unlink, config_path)
|
||||
c = config.Config(self.tempdir.path)
|
||||
self.assertEqual(True, c.collapse_pre_releases)
|
||||
|
||||
def test_get_default(self):
|
||||
d = config.Config.get_default('notesdir')
|
||||
self.assertEqual('notes', d)
|
||||
|
Loading…
x
Reference in New Issue
Block a user