Skip to content

Commit 24c738a

Browse files
bpo-29845: Mark tests that use _testcapi as CPython-only (#711)
1 parent 6b5a9ec commit 24c738a

File tree

5 files changed

+8
-1
lines changed

5 files changed

+8
-1
lines changed

Lib/ctypes/test/test_structures.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from ctypes import *
33
from ctypes.test import need_symbol
44
from struct import calcsize
5-
import _testcapi
65
import _ctypes_test
6+
import test.support
77

88
class SubclassesTest(unittest.TestCase):
99
def test_subclass(self):
@@ -202,7 +202,10 @@ class X(Structure):
202202
"_pack_": -1}
203203
self.assertRaises(ValueError, type(Structure), "X", (Structure,), d)
204204

205+
@test.support.cpython_only
206+
def test_packed_c_limits(self):
205207
# Issue 15989
208+
import _testcapi
206209
d = {"_fields_": [("a", c_byte)],
207210
"_pack_": _testcapi.INT_MAX + 1}
208211
self.assertRaises(ValueError, type(Structure), "X", (Structure,), d)

Lib/test/test_atexit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def test_bound_methods(self):
143143
self.assertEqual(l, [5])
144144

145145

146+
@support.cpython_only
146147
class SubinterpreterTest(unittest.TestCase):
147148

148149
def test_callbacks_leak(self):

Lib/test/test_coroutines.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,7 @@ def wrap(gen):
21172117
sys.set_coroutine_wrapper(None)
21182118

21192119

2120+
@support.cpython_only
21202121
class CAPITest(unittest.TestCase):
21212122

21222123
def test_tp_await_1(self):

Lib/test/test_socket.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ def testNtoH(self):
906906
self.assertEqual(swapped & mask, mask)
907907
self.assertRaises(OverflowError, func, 1<<34)
908908

909+
@support.cpython_only
909910
def testNtoHErrors(self):
910911
import _testcapi
911912
s_good_values = [0, 1, 2, 0xffff]

Lib/test/test_tracemalloc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,7 @@ def test_sys_xoptions_invalid(self):
865865
b'number of frames',
866866
stderr)
867867

868+
@unittest.skipIf(_testcapi is None, 'need _testcapi')
868869
def test_pymem_alloc0(self):
869870
# Issue #21639: Check that PyMem_Malloc(0) with tracemalloc enabled
870871
# does not crash.

0 commit comments

Comments
 (0)