Merge ~ogayot/ubiquity:fix-unittest-python3.11 into ubiquity:main

Proposed by Olivier Gayot
Status: Merged
Merged at revision: 0e37f20cccbbc819f22ad2e836cca5cccedecc31
Proposed branch: ~ogayot/ubiquity:fix-unittest-python3.11
Merge into: ubiquity:main
Diff against target: 54 lines (+10/-4)
2 files modified
debian/changelog (+6/-0)
tests/test_ubi_console_setup.py (+4/-4)
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Review via email: mp+436402@code.staging.launchpad.net

Commit message

tests: make test_ubi_console_setup compatible with python 3.11

Description of the change

In python3.11, the pkgutil.resolve_name function is called by unitest.mock.patch. This makes mock.patch unable to cope with invalid python module names (i.e., that contains hyphens).

It is a problem for ubiquity since we import modules that contain hyphens using importlib through load_plugins.

To work around the issue, patch the imported object rather than patching the symbol name.

To post a comment you must log in.
Revision history for this message
Olivier Gayot (ogayot) wrote :
Revision history for this message
Steve Langasek (vorlon) :
review: Approve

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches