-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
plugin: unittestrelated to the unittest integration builtin pluginrelated to the unittest integration builtin plugintype: regressionindicates a problem that was introduced in a release which was working previouslyindicates a problem that was introduced in a release which was working previously
Description
pytest 8.2.2 breaks pytest-rerunfailures for tests that inherit unittest.TestCase
The code: (placed in new_file.py)
from unittest import TestCase
class MyTestClass(TestCase):
def test_base(self):
self.fail()Run command:
pytest new_file.py --reruns=1Expected output: (Using pytest==8.2.1 / previous version)
self = <examples.new_file.MyTestClass testMethod=test_base>
def test_base(self):
> self.fail()
E AssertionError: None
new_file.py:5: AssertionError
Regression output: (Using pytest==8.2.2 / latest version)
self = <TestCaseFunction test_base>
def runtest(self) -> None:
from _pytest.debugging import maybe_wrap_pytest_function_for_tracing
testcase = self.instance
> assert testcase is not None
E AssertionError
The error occurs during the rerun of the test.
The failure line should be self.fail(). Instead, it's assert testcase is not None.
This causes the rerun to never happen. (The test only ran the first time)
Tested on a Mac. Here's the pip list:
Package Version
-------------------- -------
iniconfig 2.0.0
packaging 24.0
pip 24.0
pluggy 1.5.0
pytest 8.2.2
pytest-rerunfailures 14.0hb2638
Metadata
Metadata
Assignees
Labels
plugin: unittestrelated to the unittest integration builtin pluginrelated to the unittest integration builtin plugintype: regressionindicates a problem that was introduced in a release which was working previouslyindicates a problem that was introduced in a release which was working previously