diff options
| author | Simon Glass <[email protected]> | 2025-05-10 13:05:09 +0200 |
|---|---|---|
| committer | Simon Glass <[email protected]> | 2025-05-27 10:07:42 +0100 |
| commit | dff62ec8b4034ff97e21739e6c2eb8f2b4312b5f (patch) | |
| tree | 84fa30196a32d9b6aa0f9bbf6287961cbcfb7b33 | |
| parent | 56d33104e1961df27899d335ad55ecf4b9785cbd (diff) | |
patman: Support returning the parsers to use
The parsing tests need to be able to try invalid arguments to make sure
that these are handled correctly. Provide a way to return the parsers
being used, as well as to pass in the parsers to use. This feature is
needed in test_series_no_subcmd(), for example.
Signed-off-by: Simon Glass <[email protected]>
| -rw-r--r-- | tools/patman/cmdline.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/patman/cmdline.py b/tools/patman/cmdline.py index e34cf126556..1b2a32c99f7 100644 --- a/tools/patman/cmdline.py +++ b/tools/patman/cmdline.py @@ -209,10 +209,13 @@ def setup_parser(): test_parser.add_argument('testname', type=str, default=None, nargs='?', help="Specify the test to run") - return parser + parsers = { + 'main': parser, + } + return parsers -def parse_args(argv=None, config_fname=None, parser=None): +def parse_args(argv=None, config_fname=None, parsers=None): """Parse command line arguments from sys.argv[] Args: @@ -225,8 +228,9 @@ def parse_args(argv=None, config_fname=None, parser=None): options: command line options args: command lin arguments """ - if not parser: - parser = setup_parser() + if not parsers: + parsers = setup_parser() + parser = parsers['main'] # Parse options twice: first to get the project and second to handle # defaults properly (which depends on project) |
