Skip to content

Python 3.11 unit tests are failing due to argparse error #2015

Closed
@JohnVillalovos

Description

@JohnVillalovos

Python 3.11 unit tests are failing due to an argparse error.

Appears to be because of this PR in cpython: python/cpython#18605

Example of the error is:

______________________________ test_v4_parse_args ______________________________

    def test_v4_parse_args():
>       parser = cli._get_parser()

tests/unit/test_cli.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
gitlab/cli.py:254: in _get_parser
    return gitlab.v4.cli.extend_parser(parser)
gitlab/v4/cli.py:340: in extend_parser
    object_group = subparsers.add_parser(arg_name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = _SubParsersAction(option_strings=[], dest='what', nargs='A...', const=None, default=None, type=None, choices={'applica....HelpFormatter'>, conflict_handler='error', add_help=True)}, required=True, help='Object to manipulate.', metavar=None)
name = 'project-audit-event', kwargs = {'prog': 'pytest project-audit-event'}
aliases = ()

    def add_parser(self, name, **kwargs):
        # set prog from the existing prefix
        if kwargs.get('prog') is None:
            kwargs['prog'] = '%s %s' % (self._prog_prefix, name)
    
        aliases = kwargs.pop('aliases', ())
    
        if name in self._name_parser_map:
>           raise ArgumentError(self, _('conflicting subparser: %s') % name)
E           argparse.ArgumentError: argument what: conflicting subparser: project-audit-event

/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/argparse.py:1185: ArgumentError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions