Unit test failure with Python 3.11 in test_shell.py

Bug #1998856 reported by Thomas Goirand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
New
Undecided
Unassigned

Bug Description

Hi,

Below are the 2 unit test failures reported at:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1025110

I'm not sure, but to me, test_load_versioned_actions() and test_load_actions_with_versioned_args() are calling shell._find_actions() twice, with the same subparser name, which now raises ArgumentError under Python 3.11 (see https://docs.python.org/3.11/whatsnew/changelog.html, search for bpo-39716).

As it seems a test case issue, I'm blacklisting these 2 buggy tests in my package until this is fixed.

======================================================================
FAIL: novaclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_actions_with_versioned_args
novaclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_actions_with_versioned_args
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/usr/lib/python3.11/unittest/mock.py", line 1369, in patched
    return func(*newargs, **newkeywargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/novaclient/tests/unit/test_shell.py", line 920, in test_load_actions_with_versioned_args
    shell._find_actions(subparsers, fake_actions_module,
  File "/<<PKGBUILDDIR>>/novaclient/shell.py", line 450, in _find_actions
    subparser = subparsers.add_parser(
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/argparse.py", line 1197, in add_parser
    raise ArgumentError(self, _('conflicting subparser: %s') % name)
argparse.ArgumentError: argument <subcommand>: conflicting subparser: another-fake-action

======================================================================
FAIL: novaclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_versioned_actions
novaclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_versioned_actions
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/novaclient/tests/unit/test_shell.py", line 800, in test_load_versioned_actions
    shell._find_actions(subparsers, fake_actions_module,
  File "/<<PKGBUILDDIR>>/novaclient/shell.py", line 450, in _find_actions
    subparser = subparsers.add_parser(
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/argparse.py", line 1197, in add_parser
    raise ArgumentError(self, _('conflicting subparser: %s') % name)
argparse.ArgumentError: argument <subcommand>: conflicting subparser: another-fake-action

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.