Fix finding of local config files.

This commit is contained in:
Carl Meyer 2017-08-07 13:45:31 -07:00
parent cead98598a
commit 54a8a551b3
2 changed files with 12 additions and 2 deletions

View file

@ -131,8 +131,8 @@ class Application(object):
pass
opts, args = self.option_manager.parse_known_args(args)
# parse_known_args includes unknown options as args; get rid of them
args = [a for a in args if not a.startswith('-')]
# parse_known_args includes program name and unknown options as args
args = [a for a in args[1:] if not a.startswith('-')]
self.prelim_opts, self.prelim_args = opts, args
def exit(self):

View file

@ -96,3 +96,13 @@ def test_returns_specified_plugin(application):
assert execute is application.formatter_for('desired')
assert warning.called is False
def test_prelim_opts_args(application):
"""Verify we get sensible prelim opts and args."""
application.parse_preliminary_options_and_args(
['flake8', '--foo', '--verbose', 'src', 'setup.py', '--statistics'])
assert application.prelim_opts.statistics
assert application.prelim_opts.verbose
assert application.prelim_args == ['src', 'setup.py']