aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_weakref.py
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2024-04-03 15:11:36 +0200
committerGitHub <noreply@github.com>2024-04-03 15:11:36 +0200
commitea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e (patch)
tree7fc58f8dcd7513427c7ea2ff9d7bad523be1118a /Lib/test/test_weakref.py
parent2ec6bb4111d2c03c1cac02b27c74beee7e5a2a05 (diff)
downloadcpython-ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.tar.gz
cpython-ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.zip
gh-116303: Skip test module dependent tests if test modules are unavailable (#117341)
Diffstat (limited to 'Lib/test/test_weakref.py')
-rw-r--r--Lib/test/test_weakref.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index d6470fb6919..6fbd292c1e6 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -14,6 +14,7 @@ import random
from test import support
from test.support import script_helper, ALWAYS_EQ
from test.support import gc_collect
+from test.support import import_helper
from test.support import threading_helper
# Used in ReferencesTestCase.test_ref_created_during_del() .
@@ -161,7 +162,7 @@ class ReferencesTestCase(TestBase):
@support.cpython_only
def test_cfunction(self):
- import _testcapi
+ _testcapi = import_helper.import_module("_testcapi")
create_cfunction = _testcapi.create_cfunction
f = create_cfunction()
wr = weakref.ref(f)