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

@ -22,7 +22,7 @@ from operator import lt, le, gt, ge, eq, ne, truediv, floordiv, mod
from test import support
from test.support import is_resource_enabled, ALWAYS_EQ, LARGEST, SMALLEST
from test.support import warnings_helper
from test.support import warnings_helper, no_rerun
import datetime as datetime_module
from datetime import MINYEAR, MAXYEAR
@ -47,26 +47,6 @@ except ImportError:
pass
#
# This is copied from test_import/__init__.py.
# XXX Move it to support/__init__.py.
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
pickle_loads = {pickle.loads, pickle._loads}
pickle_choices = [(pickle, pickle, proto)