mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-119659: Move @no_rerun
to test.support
(#119660)
This commit is contained in:
parent
f912e5a2f6
commit
2da0dc094f
3 changed files with 21 additions and 41 deletions
|
@ -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.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue