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 @@ -106,6 +106,25 @@ def remove_files(name):
106106 rmtree ('__pycache__' )
107107
108108
109+ def no_rerun (reason ):
110+ """Skip rerunning for a particular test.
111+
112+ WARNING: Use this decorator with care; skipping rerunning makes it
113+ impossible to find reference leaks. Provide a clear reason for skipping the
114+ test using the 'reason' parameter.
115+ """
116+ def deco (func ):
117+ _has_run = False
118+ def wrapper (self ):
119+ nonlocal _has_run
120+ if _has_run :
121+ self .skipTest (reason )
122+ func (self )
123+ _has_run = True
124+ return wrapper
125+ return deco
126+
127+
109128@contextlib .contextmanager
110129def _ready_to_import (name = None , source = "" ):
111130 # sets up a temporary directory and removes it
@@ -2018,10 +2037,6 @@ class SinglephaseInitTests(unittest.TestCase):
20182037
20192038 @classmethod
20202039 def setUpClass (cls ):
2021- if '-R' in sys .argv or '--huntrleaks' in sys .argv :
2022- # https://github.com/python/cpython/issues/102251
2023- raise unittest .SkipTest ('unresolved refleaks (see gh-102251)' )
2024-
20252040 spec = importlib .util .find_spec (cls .NAME )
20262041 from importlib .machinery import ExtensionFileLoader
20272042 cls .FILE = spec .origin
@@ -2535,6 +2550,7 @@ def test_basic_multiple_interpreters_main_no_reset(self):
25352550 # * m_copy was copied from interp2 (was from interp1)
25362551 # * module's global state was updated, not reset
25372552
2553+ @no_rerun (reason = "rerun not possible; module state is never cleared (see gh-102251)" )
25382554 @requires_subinterpreters
25392555 def test_basic_multiple_interpreters_deleted_no_reset (self ):
25402556 # without resetting; already loaded in a deleted interpreter
You can’t perform that action at this time.
0 commit comments