File tree 1 file changed +20
-4
lines changed
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):
107
107
rmtree ('__pycache__' )
108
108
109
109
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
+
110
129
@contextlib .contextmanager
111
130
def _ready_to_import (name = None , source = "" ):
112
131
# sets up a temporary directory and removes it
@@ -1989,10 +2008,6 @@ class SinglephaseInitTests(unittest.TestCase):
1989
2008
1990
2009
@classmethod
1991
2010
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
-
1996
2011
spec = importlib .util .find_spec (cls .NAME )
1997
2012
from importlib .machinery import ExtensionFileLoader
1998
2013
cls .FILE = spec .origin
@@ -2502,6 +2517,7 @@ def test_basic_multiple_interpreters_main_no_reset(self):
2502
2517
# * m_copy was copied from interp2 (was from interp1)
2503
2518
# * module's global state was updated, not reset
2504
2519
2520
+ @no_rerun (reason = "rerun not possible; module state is never cleared (see gh-102251)" )
2505
2521
@requires_subinterpreters
2506
2522
def test_basic_multiple_interpreters_deleted_no_reset (self ):
2507
2523
# without resetting; already loaded in a deleted interpreter
You can’t perform that action at this time.
0 commit comments