mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-04 20:26:53 +00:00
application: Ensure -h/--help is unknown during preliminary parsing
Now that the preliminary parser is being used, we can remove needing to prune out `-h` and `--help` from the copied `args` list.
This commit is contained in:
parent
2260f5362e
commit
b9c8c3e118
2 changed files with 14 additions and 8 deletions
|
|
@ -129,14 +129,6 @@ class Application(object):
|
|||
args.remove("--version")
|
||||
except ValueError:
|
||||
pass
|
||||
try:
|
||||
args.remove("--help")
|
||||
except ValueError:
|
||||
pass
|
||||
try:
|
||||
args.remove("-h")
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return self.prelim_arg_parser.parse_known_args(args)
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,20 @@ def test_prelim_opts_args(application):
|
|||
assert args == ['--foo', 'src', 'setup.py', '--statistics']
|
||||
|
||||
|
||||
def test_prelim_opts_ignore_help(application):
|
||||
"""Verify -h/--help is not handled."""
|
||||
# GIVEN
|
||||
|
||||
# WHEN
|
||||
_, args = application.parse_preliminary_options_and_args([
|
||||
'--help',
|
||||
'-h',
|
||||
])
|
||||
|
||||
# THEN
|
||||
assert args == ['--help', '-h']
|
||||
|
||||
|
||||
def test_prelim_opts_handles_empty(application):
|
||||
"""Verify empty argv lists are handled correctly."""
|
||||
irrelevant_args = ['myexe', '/path/to/foo']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue