Skip to content

Commit 39446ab

Browse files
committed
Skip test when _ctypes is not available
1 parent 4278bc5 commit 39446ab

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Lib/test/test_stable_abi_ctypes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
"""
66

77
import unittest
8-
from ctypes import pythonapi
8+
from test.support.import_helper import import_module
9+
10+
ctypes_test = import_module('ctypes')
911

1012
class TestStableABIAvailability(unittest.TestCase):
1113
def test_available_symbols(self):
1214
for symbol_name in SYMBOL_NAMES:
1315
with self.subTest(symbol_name):
14-
pythonapi[symbol_name]
16+
ctypes_test.pythonapi[symbol_name]
1517

1618
SYMBOL_NAMES = (
1719

Tools/scripts/stable_abi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,15 @@ def gen_ctypes_test(manifest, args, outfile):
270270
"""
271271
272272
import unittest
273-
from ctypes import pythonapi
273+
from test.support.import_helper import import_module
274+
275+
ctypes_test = import_module('ctypes')
274276
275277
class TestStableABIAvailability(unittest.TestCase):
276278
def test_available_symbols(self):
277279
for symbol_name in SYMBOL_NAMES:
278280
with self.subTest(symbol_name):
279-
pythonapi[symbol_name]
281+
ctypes_test.pythonapi[symbol_name]
280282
281283
SYMBOL_NAMES = (
282284
'''))

0 commit comments

Comments
 (0)