Detect invalid test setups in settings tests
Should prevent future cases of the chainmap issue observed in #2828 and maybe also #2829
This commit is contained in:
1 parent
95a9f84b39
commit
e5e8581f9a
1 file changed
+6
-1
@@ -604,6 +604,8 @@ class Settings(object):
|
||||
|
||||
self._basedir = None
|
||||
|
||||
assert(isinstance(default_settings, dict))
|
||||
|
||||
self._map = HierarchicalChainMap(dict(), default_settings)
|
||||
|
||||
self._config = None
|
||||
@@ -874,6 +876,7 @@ class Settings(object):
|
||||
try:
|
||||
self._config = yaml.safe_load(f)
|
||||
self._mtime = self.last_modified
|
||||
|
||||
except yaml.YAMLError as e:
|
||||
details = e.message
|
||||
|
||||
@@ -888,10 +891,12 @@ class Settings(object):
|
||||
details=details,
|
||||
line=line,
|
||||
column=column)
|
||||
|
||||
except:
|
||||
raise
|
||||
|
||||
# changed from else to handle cases where the file exists, but is empty / 0 bytes
|
||||
if not self._config:
|
||||
if not self._config or not isinstance(self._config, dict):
|
||||
self._config = dict()
|
||||
|
||||
if migrate:
|
||||
|
||||
Reference in new issue
Block a user