Commit 9e967ef5 authored by Jason Frisvold's avatar Jason Frisvold
Browse files

- Add test to check for nonexistent section

- Remove extraneous exception code
parent 924153b3
......@@ -62,19 +62,10 @@ class SkynetConfig(object):
config.read(self._configfile)
except configparser.Error as e:
self._logger.exception('Unable to load config file = {0}'.format(e))
except Exception as e:
e = sys.exc_info()[0]
self._logger.exception('Unable to load config file = {0}'.format(e))
try:
for each_section in config.sections():
for (each_key, each_val) in config.items(each_section):
self._cfg[each_section][each_key] = each_val
except configparser.NoSectionError as e:
self._logger.exception('Unable to find config option: {0}'.format(e))
except Exception as e:
e = sys.exc_info()[0]
self._logger.exception('Unable to load config file = {0}'.format(e))
for each_section in config.sections():
for (each_key, each_val) in config.items(each_section):
self._cfg[each_section][each_key] = each_val
if self._logger.isEnabledFor(logging.DEBUG):
for k, v in list(self._cfg.items()):
......
......@@ -133,6 +133,7 @@ class TestSkynetConfig(object):
'version': '1.0'}
assert configobject.getsection('global') == defaultconfig
assert configobject.getsection('doesnotexist') == {}
def test_getsectionkey(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment