Fix bugs found while writing parse_cli_config test

This commit is contained in:
Ian Cordasco 2016-01-10 13:22:18 -06:00
parent 03fd22c230
commit a8576aff12
3 changed files with 25 additions and 3 deletions

View file

@ -186,9 +186,11 @@ class MergedConfigParser(object):
value = method(self.program_name, option_name)
LOG.debug('Option "%s" returned value: %r', option_name, value)
final_value = self._normalize_value(value)
final_value = self._normalize_value(option, value)
config_dict[option_name] = final_value
return config_dict
def is_configured_by(self, config):
"""Check if the specified config parser has an appropriate section."""
return config.has_section(self.program_name)

View file

@ -104,7 +104,8 @@ class Option(object):
'dest={dest}, type={type}, callback={callback}, help={help},'
' callback={callback}, callback_args={callback_args}, '
'callback_kwargs={callback_kwargs}, metavar={metavar})'
).format(*self.option_args, **self.option_kwargs)
).format(self.short_option_name, self.long_option_name,
**self.option_kwargs)
def _make_dest(self, dest):
if dest: