Fix unit tests for Python 3.11
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-django (Ubuntu) |
Fix Released
|
Undecided
|
Lena Voytek |
Bug Description
When building Django for Lunar, which will be using Python 3.11, some unit tests fail. This causes a build failure, such as with the most recent merge:
This is due to a change with the unittest library where, when printing self, it now also shows the runTest function name with the class. For example, with the following code:
from unittest import TestCase
class SimpleTestcase(
def test_foo(self):
print(self)
t = SimpleTestcase()
t.test_foo()
in Python 3.10 "runTest (__main_
This breaks the tests:
test_add_
test_skip_
test_skip_
test_output_verbose
Related branches
- git-ubuntu bot: Approve
- Christian Ehrhardt (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 159 lines (+125/-1)4 files modifieddebian/changelog (+7/-0)
debian/control (+2/-1)
debian/patches/0012-Add-Python-3.11-support-for-tests.patch (+115/-0)
debian/patches/series (+1/-0)
Changed in python-django (Ubuntu): | |
status: | New → In Progress |
assignee: | nobody → Lena Voytek (lvoytek) |
This bug was fixed in the package python-django - 3:3.2.16-1ubuntu1
---------------
python-django (3:3.2.16-1ubuntu1) lunar; urgency=medium
* d/p/0012- Add-Python- 3.11-support- for-tests. patch: Make unit tests
compatible with Python 3.11 to fix build errors (LP: #2002012)
-- Lena Voytek <email address hidden> Fri, 06 Jan 2023 11:02:03 -0700