Fix circular reference in CustomTestCase.__init_subclass__ (#21650)
Co-authored-by: wan4ch <wan4ch@gmail.com>
This commit is contained in:
@@ -2068,9 +2068,11 @@ class CustomTestCase(unittest.TestCase):
|
|||||||
if getattr(setup, "_safe_setup_wrapped", False):
|
if getattr(setup, "_safe_setup_wrapped", False):
|
||||||
return
|
return
|
||||||
|
|
||||||
def safe_setUpClass(klass, _orig=setup):
|
orig_func = setup.__func__
|
||||||
|
|
||||||
|
def safe_setUpClass(klass):
|
||||||
try:
|
try:
|
||||||
_orig.__func__(klass)
|
orig_func(klass)
|
||||||
except Exception:
|
except Exception:
|
||||||
# Best-effort cleanup; suppress teardown errors so the
|
# Best-effort cleanup; suppress teardown errors so the
|
||||||
# original setUpClass exception propagates clearly.
|
# original setUpClass exception propagates clearly.
|
||||||
|
|||||||
Reference in New Issue
Block a user