Comment 0 for bug 2045171

Revision history for this message
Will (wsha) wrote :

Python 3.12 added an addDuration method: https://docs.python.org/3/library/unittest.html#unittest.TestResult.addDuration. The unittest test runner tries to use this method now and triggers a warning if it is not present. I specifically encounter this warning when using stestr which wraps test results with AutoTimingTestResultDectorator (see here: https://github.com/mtreinish/stestr/blob/cc66736df90968126585540b220fea663b124bbf/stestr/subunit_runner/run.py#L44-L45). An example of a project where this warning is generated like this is rustworkx. Here is a CI log with the warning generated: https://github.com/Qiskit/rustworkx/actions/runs/7012357436/job/19076767764.

A simpler reproducer is to use `stestr -t . run test` with a test.py file with this content (tested with stestr 4.1.0):

```
from unittest import TestCase

class TestExample(TestCase):
    def test_pass(self):
        pass
```