Public bug reported:

[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.

** Affects: nose (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: nose (Ubuntu Noble)
     Importance: Undecided
         Status: New

** Affects: nose (Ubuntu Oracular)
     Importance: Undecided
         Status: New

** Affects: nose (Ubuntu Plucky)
     Importance: Undecided
         Status: New

** Affects: nose (Ubuntu Questing)
     Importance: Undecided
         Status: New

** Description changed:

  [Impact]
- Spurious warnings in tests, might cause tests to fail when asserting that 
stderr is empty.
+ 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.

** Summary changed:

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

** Also affects: nose (Ubuntu Oracular)
   Importance: Undecided
       Status: New

** Also affects: nose (Ubuntu Plucky)
   Importance: Undecided
       Status: New

** Also affects: nose (Ubuntu Noble)
   Importance: Undecided
       Status: New

** Also affects: nose (Ubuntu Questing)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2109342

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nose/+bug/2109342/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to