[noble+] TestResult has no addDuration method with Python 3.12

Bug #2109342 reported by Julian Andres Klode
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nose (Ubuntu)
New
Undecided
Unassigned
Noble
New
Undecided
Unassigned
Oracular
Won't Fix
Undecided
Unassigned
Plucky
New
Undecided
Unassigned
Questing
New
Undecided
Unassigned
python-mock (Ubuntu)
New
Undecided
Unassigned
Noble
New
Undecided
Unassigned
Oracular
Won't Fix
Undecided
Unassigned
Plucky
New
Undecided
Unassigned
Questing
New
Undecided
Unassigned

Bug Description

[Impact]
Spurious warnings in tests since Python 3.12, might cause tests to fail when asserting that stderr is empty.

[Test plan]
Run the update-manager autopkgtest and see no such warning.

[Where problems could occur]
There is no regression potential basically. The code creating the warning in Python 3.12+ looks like:

    def _addDuration(self, result, elapsed):
        try:
            addDuration = result.addDuration
        except AttributeError:
            warnings.warn("TestResult has no addDuration method",
                          RuntimeWarning, 1)
        else:
            addDuration(self, elapsed)

that is, if the addDuration method does not exist, it logs a warning and does nothing else. By adding the addDuration method, the warning is not printed.

The addDuration method adds the execution time of the test to the test result, but nose's test results does not track that, so meh.

description: updated
summary: - [oracular+] TestResult has no addDuration method
+ [noble+] TestResult has no addDuration method with Python 3.12
Revision history for this message
Julian Andres Klode (juliank) wrote :

Hacking up my Python to raise an exception instead I get

'ResultProxy' object has no attribute 'addDuration'

i.e. mock's ResultProxy class is also affected.

For nose, the nose2 commit https://github.com/nose-devs/nose2/pull/570/files applies to nose too.

I may not pursue this further as this is comparatively lower priority to my other work.

Revision history for this message
Ural Tunaboyu (uralt) wrote :

Ubuntu 24.10 (Oracular Oriole) has reached end of life, so this bug will not be fixed for that specific release.

Changed in nose (Ubuntu Oracular):
status: New → Won't Fix
Changed in python-mock (Ubuntu Oracular):
status: New → Won't Fix
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.