-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Closed
Copy link
Labels
CoreCLI core infrastructureCLI core infrastructurecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.feature-request
Milestone
Description
Related command
Attempting to run tests for azure-cli-core.
Describe the bug
While running pytest to test azure-cli-core, many tests fail in Python 3.11.0b3 due to conflicting subparsers. Here is an example:
__________________ TestParser.test_parser_error_spellchecker ___________________
[gw0] linux -- Python 3.11.0 /usr/bin/python3
self = <azure.cli.core.tests.test_parser.TestParser testMethod=test_parser_error_spellchecker>
@mock.patch('importlib.import_module', _mock_import_lib)
@mock.patch('pkgutil.iter_modules', _mock_iter_modules)
@mock.patch('azure.cli.core.commands._load_command_loader', _mock_load_command_loader)
@mock.patch('azure.cli.core.extension.get_extension_modname', _mock_extension_modname)
@mock.patch('azure.cli.core.extension.get_extensions', _mock_get_extensions)
def test_parser_error_spellchecker(self):
cli = DummyCli()
main_loader = MainCommandsLoader(cli)
cli.loader = main_loader
cli.loader.load_command_table(None)
parser = cli.parser_cls(cli)
> parser.load_command_table(cli.loader)
src/azure-cli-core/azure/cli/core/tests/test_parser.py:206:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/azure-cli-core/azure/cli/core/parser.py:100: in load_command_table
command_parser = subparser.add_parser(command_verb,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = _SubParsersAction(option_strings=[], dest='_subcommand', nargs='A...', const=None, default=None, type=None, choices={'module': 'module'}, required=True, help=None, metavar=None)
name = 'module'
kwargs = {'_command_source': 'azure.cli.core.tests.test_parser', 'cli_help': None, 'conflict_handler': 'error', 'description': None, ...}
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 _subcommand: conflicting subparser: module
/usr/lib64/python3.11/argparse.py:1185: ArgumentError
For the full output, check the build log from a Fedora package build. I've also copied out just the pytest output into a GitHub Gist to make it easier to read.
To Reproduce
Run pytest src/azure-cli-core with Python 3.11.0b3.
Expected behavior
I expected the tests to pass (as they do in Python 3.10.5).
Environment summary
Building an RPM package for azure-cli with Python 3.11.0b3 in Fedora 37.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
CoreCLI core infrastructureCLI core infrastructurecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.feature-request