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 @@ -106,6 +106,25 @@ def remove_files(name):
106
106
rmtree ('__pycache__' )
107
107
108
108
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
+
109
128
@contextlib .contextmanager
110
129
def _ready_to_import (name = None , source = "" ):
111
130
# sets up a temporary directory and removes it
@@ -2018,10 +2037,6 @@ class SinglephaseInitTests(unittest.TestCase):
2018
2037
2019
2038
@classmethod
2020
2039
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
-
2025
2040
spec = importlib .util .find_spec (cls .NAME )
2026
2041
from importlib .machinery import ExtensionFileLoader
2027
2042
cls .FILE = spec .origin
@@ -2535,6 +2550,7 @@ def test_basic_multiple_interpreters_main_no_reset(self):
2535
2550
# * m_copy was copied from interp2 (was from interp1)
2536
2551
# * module's global state was updated, not reset
2537
2552
2553
+ @no_rerun (reason = "rerun not possible; module state is never cleared (see gh-102251)" )
2538
2554
@requires_subinterpreters
2539
2555
def test_basic_multiple_interpreters_deleted_no_reset (self ):
2540
2556
# without resetting; already loaded in a deleted interpreter
You can’t perform that action at this time.
0 commit comments