Definitely fix bug reading options from config files

Previously we were not reading output_file or enable_extensions from
user provided configuration files. The configuration option name
provided to config_options needs to be hyphenated in order for pep8 to
recognize and parse out the option correctly. Also, the destination name
needs to match the configuration option name that pep8 looks for
otherwise it will raise an unhandled KeyError exception.
This commit is contained in:
Ian Cordasco 2016-02-11 09:41:14 -06:00
parent 388db0d811
commit 7d40f525f0
2 changed files with 3 additions and 3 deletions

View file

@ -103,11 +103,11 @@ def get_parser():
type='string', nargs=1, action='callback',
callback=callbacks.redirect_stdout)
parser.add_option('--enable-extensions', default='',
dest='enabled_extensions',
dest='enable_extensions',
help='Enable plugins and extensions that are disabled '
'by default',
type='string')
parser.config_options.extend(['output_file', 'enable_extensions'])
parser.config_options.extend(['output-file', 'enable-extensions'])
parser.ignored_extensions = ignored
return parser, options_hooks

View file

@ -62,7 +62,7 @@ class TestEngine(unittest.TestCase):
parser.ignored_extensions = ['I123', 'I345', 'I678', 'I910']
options.enabled_extensions = 'I345,\nI678,I910'
options.enable_extensions = 'I345,\nI678,I910'
options.ignore = ('E121', 'E123')
engine._disable_extensions(parser, options)