This fixes unittest test reruns when using plugins like pytest-rerunfailures. The `instance` property uses AttributeError to check if the instance needs to be initialized, so `del` is the correct way to clear it, not setting to `None`. Regressed in 8.2.2.
12 lines
268 B
Python
12 lines
268 B
Python
import unittest
|
|
|
|
|
|
class MyTestCase(unittest.TestCase):
|
|
first_time = True
|
|
|
|
def test_fail_the_first_time(self) -> None:
|
|
"""Regression test for issue #12424."""
|
|
if self.first_time:
|
|
type(self).first_time = False
|
|
self.fail()
|