bpo-29845: Mark tests that use _testcapi as CPython-only (#711) (#725) · python/cpython@da88596 (original) (raw)

5 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
2 2 from ctypes import *
3 3 from ctypes.test import need_symbol
4 4 from struct import calcsize
5 -import _testcapi
6 5 import _ctypes_test
6 +import test.support
7 7
8 8 class SubclassesTest(unittest.TestCase):
9 9 def test_subclass(self):
@@ -202,7 +202,10 @@ class X(Structure):
202 202 "_pack_": -1}
203 203 self.assertRaises(ValueError, type(Structure), "X", (Structure,), d)
204 204
205 +@test.support.cpython_only
206 +def test_packed_c_limits(self):
205 207 # Issue 15989
208 +import _testcapi
206 209 d = {"_fields_": [("a", c_byte)],
207 210 "_pack_": _testcapi.INT_MAX + 1}
208 211 self.assertRaises(ValueError, type(Structure), "X", (Structure,), d)
Original file line number Diff line number Diff line change
@@ -143,6 +143,7 @@ def test_bound_methods(self):
143 143 self.assertEqual(l, [5])
144 144
145 145
146 +@support.cpython_only
146 147 class SubinterpreterTest(unittest.TestCase):
147 148
148 149 def test_callbacks_leak(self):
Original file line number Diff line number Diff line change
@@ -2117,6 +2117,7 @@ def wrap(gen):
2117 2117 sys.set_coroutine_wrapper(None)
2118 2118
2119 2119
2120 +@support.cpython_only
2120 2121 class CAPITest(unittest.TestCase):
2121 2122
2122 2123 def test_tp_await_1(self):
Original file line number Diff line number Diff line change
@@ -906,6 +906,7 @@ def testNtoH(self):
906 906 self.assertEqual(swapped & mask, mask)
907 907 self.assertRaises(OverflowError, func, 1<<34)
908 908
909 +@support.cpython_only
909 910 def testNtoHErrors(self):
910 911 good_values = [ 1, 2, 3, 1, 2, 3 ]
911 912 bad_values = [ -1, -2, -3, -1, -2, -3 ]
Original file line number Diff line number Diff line change
@@ -865,6 +865,7 @@ def test_sys_xoptions_invalid(self):
865 865 b'number of frames',
866 866 stderr)
867 867
868 +@unittest.skipIf(_testcapi is None, 'need _testcapi')
868 869 def test_pymem_alloc0(self):
869 870 # Issue #21639: Check that PyMem_Malloc(0) with tracemalloc enabled
870 871 # does not crash.