unittest: add addDuration function for Python 3.12 support
Fix #10875 Without this, fails with ``` ... E AttributeError: 'TestCaseFunction' object has no attribute 'addDuration' ... E RuntimeWarning: TestResult has no addDuration method ```
This commit is contained in:
parent
1b196fbeaf
commit
1b81d636e2
|
@ -0,0 +1 @@
|
|||
Python 3.12 support: fixed ``RuntimeError: TestResult has no addDuration method`` when running ``unittest`` tests.
|
|
@ -298,6 +298,9 @@ class TestCaseFunction(Function):
|
|||
def stopTest(self, testcase: "unittest.TestCase") -> None:
|
||||
pass
|
||||
|
||||
def addDuration(self, testcase: "unittest.TestCase", elapsed: float) -> None:
|
||||
pass
|
||||
|
||||
def runtest(self) -> None:
|
||||
from _pytest.debugging import maybe_wrap_pytest_function_for_tracing
|
||||
|
||||
|
|
Loading…
Reference in New Issue