diff options
| author | Eric N. Vander Weele <ericvw@gmail.com> | 2019-10-25 15:01:30 -0400 |
|---|---|---|
| committer | Eric N. Vander Weele <ericvw@gmail.com> | 2019-10-25 17:07:43 -0400 |
| commit | 2260f5362ef3d136e4233d65735641d9714f9ffc (patch) | |
| tree | 6991000312f2af80c97478bc1fcb75253786c1b7 | |
| parent | 7f46990f4b1dcd59e8c593538b37578cbf9f3d77 (diff) | |
| download | flake8-2260f5362ef3d136e4233d65735641d9714f9ffc.tar.gz | |
application: Keep unknown options in the unknown argument list
Positional arguments aren't necessary for determining where to
load configuration anymore and is safe to keep both options and
arguments to be forwarded for later parsing after configuration is
loaded.
| -rw-r--r-- | src/flake8/main/application.py | 5 | ||||
| -rw-r--r-- | tests/unit/test_application.py | 4 |
2 files changed, 2 insertions, 7 deletions
diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py index 0f86844..2354425 100644 --- a/src/flake8/main/application.py +++ b/src/flake8/main/application.py @@ -138,10 +138,7 @@ class Application(object): except ValueError: pass - opts, args = self.prelim_arg_parser.parse_known_args(args) - # parse_known_args includes unknown options as args - args = [a for a in args if not a.startswith("-")] - return opts, args + return self.prelim_arg_parser.parse_known_args(args) def exit(self): # type: () -> None diff --git a/tests/unit/test_application.py b/tests/unit/test_application.py index 15bc54d..edf853b 100644 --- a/tests/unit/test_application.py +++ b/tests/unit/test_application.py @@ -95,10 +95,8 @@ def test_prelim_opts_args(application): opts, args = application.parse_preliminary_options_and_args( ['--foo', '--verbose', 'src', 'setup.py', '--statistics']) - assert not hasattr(opts, 'foo') - assert not hasattr(opts, 'statistics') assert opts.verbose - assert args == ['src', 'setup.py'] + assert args == ['--foo', 'src', 'setup.py', '--statistics'] def test_prelim_opts_handles_empty(application): |
