File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,25 @@ def remove_files(name):
107107 rmtree ('__pycache__' )
108108
109109
110+ def no_rerun (reason ):
111+ """Skip rerunning for a particular test.
112+
113+ WARNING: Use this decorator with care; skipping rerunning makes it
114+ impossible to find reference leaks. Provide a clear reason for skipping the
115+ test using the 'reason' parameter.
116+ """
117+ def deco (func ):
118+ _has_run = False
119+ def wrapper (self ):
120+ nonlocal _has_run
121+ if _has_run :
122+ self .skipTest (reason )
123+ func (self )
124+ _has_run = True
125+ return wrapper
126+ return deco
127+
128+
110129@contextlib .contextmanager
111130def _ready_to_import (name = None , source = "" ):
112131 # sets up a temporary directory and removes it
@@ -1989,10 +2008,6 @@ class SinglephaseInitTests(unittest.TestCase):
19892008
19902009 @classmethod
19912010 def setUpClass (cls ):
1992- if '-R' in sys .argv or '--huntrleaks' in sys .argv :
1993- # https://github.com/python/cpython/issues/102251
1994- raise unittest .SkipTest ('unresolved refleaks (see gh-102251)' )
1995-
19962011 spec = importlib .util .find_spec (cls .NAME )
19972012 from importlib .machinery import ExtensionFileLoader
19982013 cls .FILE = spec .origin
@@ -2502,6 +2517,7 @@ def test_basic_multiple_interpreters_main_no_reset(self):
25022517 # * m_copy was copied from interp2 (was from interp1)
25032518 # * module's global state was updated, not reset
25042519
2520+ @no_rerun (reason = "rerun not possible; module state is never cleared (see gh-102251)" )
25052521 @requires_subinterpreters
25062522 def test_basic_multiple_interpreters_deleted_no_reset (self ):
25072523 # without resetting; already loaded in a deleted interpreter
You can’t perform that action at this time.
0 commit comments