Python3.11: test failures (OpenstackManilaShellTest)

Bug #1982946 reported by Cyril Roelandt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-manilaclient
Fix Released
Medium
Cyril Roelandt

Bug Description

The following tests fail on Python3.11:

manilaclient.tests.unit.test_shell.OpenstackManilaShellTest.test_help_on_subcommand_2___help_list
manilaclient.tests.unit.test_shell.OpenstackManilaShellTest.test_help_on_subcommand_1_list___help
manilaclient.tests.unit.test_shell.OpenstackManilaShellTest.test_help_on_subcommand_3_help_list

With the following error:

re.error: global flags not at the start of the expression at position 3

(Full stack not given because Launchpad will mess it up anyway)

This is because "global flags" should be used at the start of a regexp. Using them anywhere else has been deprecated in Python3.6 and has become an error in Python3.11:

$ cat example.py
import re
regex = 'foo(?m)'
print(re.search(regex, 'foO', re.IGNORECASE))

$ python3.10 example.py
/tmp/example.py:3: DeprecationWarning: Flags not at the start of the expression 'foo(?m)' but at position 3
  print(re.search(regex, 'foO', re.IGNORECASE))
<re.Match object; span=(0, 3), match='foO'>

$ python3.11 example.py
...
re.error: global flags not at the start of the expression at position 3

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-manilaclient (master)
Changed in python-manilaclient:
status: New → In Progress
Changed in python-manilaclient:
assignee: nobody → Cyril Roelandt (cyril-roelandt)
importance: Undecided → Medium
milestone: none → zed-client-release
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-manilaclient (master)

Reviewed: https://review.opendev.org/c/openstack/python-manilaclient/+/851220
Committed: https://opendev.org/openstack/python-manilaclient/commit/79d1f1c4f1c64022588eaca8c107f40bf1e8b499
Submitter: "Zuul (22348)"
Branch: master

commit 79d1f1c4f1c64022588eaca8c107f40bf1e8b499
Author: Cyril Roelandt <email address hidden>
Date: Wed Jul 27 14:53:16 2022 +0200

    Python3.11: fix unit test crashes

    In Python3.11, global flags must be placed right at the start of a
    regular expression.

    The following regex:

            '.*?(?m)^List NAS shares with filters.'

    muts become:

            '(?m).*?^List NAS shares with filters.'

    However, since we are using re.MULTILINE, we actually do not need to use
    a global flag.

    Closes-Bug: #1982946
    Change-Id: Ia4367ba5dbb73373986fee4d7662c12a60499b12

Changed in python-manilaclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-manilaclient 4.1.0

This issue was fixed in the openstack/python-manilaclient 4.1.0 release.

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.