Skip to content

Commit f6fc831

Browse files
[3.12] gh-102251: Disable non-rerunnable test in test_import (GH-106013) (#109540)
gh-102251: Disable non-rerunnable test in test_import (GH-106013) (cherry picked from commit 4849a80) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
1 parent fbf703c commit f6fc831

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

Lib/test/test_import/__init__.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff 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
110129
def _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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy