gh-119659: Move @no_rerun to test.support (#119660)

This commit is contained in:
Nikita Sobolev 2024-05-28 18:50:50 +03:00 committed by GitHub
parent f912e5a2f6
commit 2da0dc094f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 41 deletions

View file

@ -1189,6 +1189,25 @@ def no_tracing(func):
return coverage_wrapper
def no_rerun(reason):
"""Skip rerunning for a particular test.
WARNING: Use this decorator with care; skipping rerunning makes it
impossible to find reference leaks. Provide a clear reason for skipping the
test using the 'reason' parameter.
"""
def deco(func):
_has_run = False
def wrapper(self):
nonlocal _has_run
if _has_run:
self.skipTest(reason)
func(self)
_has_run = True
return wrapper
return deco
def refcount_test(test):
"""Decorator for tests which involve reference counting.