mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 04:56:54 +00:00
application: Register preliminary options on a separate argument parser
We introduce a new `ArgumentParser` for registering the preliminary options to be inherited by the `Application.option_manager`. The next step will be to use the `Application.prelim_arg_parser` for parsing and handling preliminary options and arguments. Note that we prevent the preliminary parser from handling `-h/--help` and defer to that to the primary parser.
This commit is contained in:
parent
1d7558f7da
commit
a90200353e
3 changed files with 20 additions and 10 deletions
|
|
@ -1,4 +1,5 @@
|
|||
"""Test aggregation of config files and command-line options."""
|
||||
import argparse
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
|
@ -14,11 +15,13 @@ CLI_SPECIFIED_CONFIG = 'tests/fixtures/config_files/cli-specified.ini'
|
|||
@pytest.fixture
|
||||
def optmanager():
|
||||
"""Create a new OptionManager."""
|
||||
prelim_parser = argparse.ArgumentParser(add_help=False)
|
||||
options.register_preliminary_options(prelim_parser)
|
||||
option_manager = manager.OptionManager(
|
||||
prog='flake8',
|
||||
version='3.0.0',
|
||||
parents=[prelim_parser],
|
||||
)
|
||||
options.register_preliminary_options(option_manager)
|
||||
options.register_default_options(option_manager)
|
||||
return option_manager
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue