Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-102251: add missing cleanups for test_import #104796

Closed
wants to merge 12 commits into from
7 changes: 7 additions & 0 deletions Lib/test/libregrtest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ def parse_args(self, kwargs):
if ns.tempdir:
ns.tempdir = os.path.expanduser(ns.tempdir)

# introduce a way to skip the ref leak tests
if ns.huntrleaks:
if ns.ignore_tests is None:
ns.ignore_tests = ["*skip_ref_leak_test"]
else:
ns.ignore_tests.append("*skip_ref_leak_test")
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved

self.ns = ns

def find_tests(self, tests):
Expand Down
6 changes: 1 addition & 5 deletions Lib/test/test_import/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1980,10 +1980,6 @@ class SinglephaseInitTests(unittest.TestCase):

@classmethod
def setUpClass(cls):
if '-R' in sys.argv or '--huntrleaks' in sys.argv:
# https://github.com/python/cpython/issues/102251
raise unittest.SkipTest('unresolved refleaks (see gh-102251)')
Comment on lines -1992 to -1994
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This trick cannot be used with ./python -m test -j n, thus causing failures on CI.


spec = importlib.util.find_spec(cls.NAME)
from importlib.machinery import ExtensionFileLoader
cls.FILE = spec.origin
Expand Down Expand Up @@ -2494,7 +2490,7 @@ def test_basic_multiple_interpreters_main_no_reset(self):
# * module's global state was updated, not reset

@requires_subinterpreters
def test_basic_multiple_interpreters_deleted_no_reset(self):
def test_basic_multiple_interpreters_deleted_no_reset_skip_ref_leak_test(self):
# without resetting; already loaded in a deleted interpreter

# At this point:
Expand Down