1717 except ImportError :
1818 pass
1919
20+ is_ios = sys .platform == 'ios'
21+
22+
2023def _setup_path ():
2124 import os , sys
2225 sys .path .insert (0 , os .path .join (os .path .dirname (__file__ ), '..' ))
@@ -1230,6 +1233,11 @@ def test_cannot_pass_struct_with_array_of_length_0():
12301233 BFunc2 = new_function_type ((BInt ,), BStruct , False )
12311234 pytest .raises (NotImplementedError , cast (BFunc2 , 123 ), 123 )
12321235
1236+ @pytest .mark .xfail (
1237+ is_ios ,
1238+ reason = "For an unknown reason f(1, cast(BInt, 42)) returns 36792864" ,
1239+ raises = AssertionError ,
1240+ )
12331241def test_call_function_9 ():
12341242 BInt = new_primitive_type ("int" )
12351243 BFunc9 = new_function_type ((BInt ,), BInt , True ) # vararg
@@ -1362,6 +1370,7 @@ def test_write_variable():
13621370 pytest .raises (ValueError , ll .write_variable , BVoidP , "stderr" , stderr )
13631371
13641372
1373+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
13651374def test_callback ():
13661375 BInt = new_primitive_type ("int" )
13671376 def make_callback ():
@@ -1378,6 +1387,7 @@ def cb(n):
13781387 assert str (e .value ) == "'int(*)(int)' expects 1 arguments, got 0"
13791388
13801389
1390+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
13811391@pytest .mark .thread_unsafe ("mocks sys.unraiseablehook" )
13821392def test_callback_exception ():
13831393 def check_value (x ):
@@ -1435,6 +1445,7 @@ def oops(*args):
14351445 assert ff (bigvalue ) == - 42
14361446
14371447
1448+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
14381449def test_callback_return_type ():
14391450 for rettype in ["signed char" , "short" , "int" , "long" , "long long" ,
14401451 "unsigned char" , "unsigned short" , "unsigned int" ,
@@ -1455,6 +1466,7 @@ def cb(n):
14551466 assert f (max - 1 ) == max
14561467 assert f (max ) == 42
14571468
1469+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
14581470def test_a_lot_of_callbacks ():
14591471 BIGNUM = 10000
14601472 if 'PY_DOT_PY' in globals (): BIGNUM = 100 # tests on py.py
@@ -1470,6 +1482,7 @@ def cb(n):
14701482 for i , f in enumerate (flist ):
14711483 assert f (- 142 ) == - 142 + i
14721484
1485+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
14731486def test_callback_receiving_tiny_struct ():
14741487 BSChar = new_primitive_type ("signed char" )
14751488 BInt = new_primitive_type ("int" )
@@ -1485,6 +1498,7 @@ def cb(s):
14851498 n = f (p [0 ])
14861499 assert n == - 42
14871500
1501+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
14881502def test_callback_returning_tiny_struct ():
14891503 BSChar = new_primitive_type ("signed char" )
14901504 BInt = new_primitive_type ("int" )
@@ -1502,6 +1516,7 @@ def cb(n):
15021516 assert s .a == - 10
15031517 assert s .b == - 30
15041518
1519+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
15051520def test_callback_receiving_struct ():
15061521 BSChar = new_primitive_type ("signed char" )
15071522 BInt = new_primitive_type ("int" )
@@ -1518,6 +1533,7 @@ def cb(s):
15181533 n = f (p [0 ])
15191534 assert n == 42
15201535
1536+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
15211537def test_callback_returning_struct ():
15221538 BSChar = new_primitive_type ("signed char" )
15231539 BInt = new_primitive_type ("int" )
@@ -1537,6 +1553,7 @@ def cb(n):
15371553 assert s .a == - 10
15381554 assert s .b == 1E-42
15391555
1556+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
15401557def test_callback_receiving_big_struct ():
15411558 BInt = new_primitive_type ("int" )
15421559 BStruct = new_struct_type ("struct foo" )
@@ -1561,6 +1578,7 @@ def cb(s):
15611578 n = f (p [0 ])
15621579 assert n == 42
15631580
1581+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
15641582def test_callback_returning_big_struct ():
15651583 BInt = new_primitive_type ("int" )
15661584 BStruct = new_struct_type ("struct foo" )
@@ -1586,6 +1604,7 @@ def cb():
15861604 for i , name in enumerate ("abcdefghij" ):
15871605 assert getattr (s , name ) == 13 - i
15881606
1607+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
15891608def test_callback_returning_void ():
15901609 BVoid = new_void_type ()
15911610 BFunc = new_function_type ((), BVoid , False )
@@ -1694,6 +1713,7 @@ def test_enum_overflow():
16941713 pytest .raises (OverflowError , new_enum_type ,
16951714 "foo" , ("AA" ,), (testcase ,), BPrimitive )
16961715
1716+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
16971717def test_callback_returning_enum ():
16981718 BInt = new_primitive_type ("int" )
16991719 BEnum = new_enum_type ("foo" , ('def' , 'c' , 'ab' ), (0 , 1 , - 20 ), BInt )
@@ -1710,6 +1730,7 @@ def cb(n):
17101730 assert f (20 ) == 20
17111731 assert f (21 ) == 21
17121732
1733+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
17131734def test_callback_returning_enum_unsigned ():
17141735 BInt = new_primitive_type ("int" )
17151736 BUInt = new_primitive_type ("unsigned int" )
@@ -1727,6 +1748,7 @@ def cb(n):
17271748 assert f (20 ) == 20
17281749 assert f (21 ) == 21
17291750
1751+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
17301752def test_callback_returning_char ():
17311753 BInt = new_primitive_type ("int" )
17321754 BChar = new_primitive_type ("char" )
@@ -1741,6 +1763,7 @@ def _hacked_pypy_uni4():
17411763 pyuni4 = {1 : True , 2 : False }[len (u + '\U00012345 ' )]
17421764 return 'PY_DOT_PY' in globals () and not pyuni4
17431765
1766+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
17441767def test_callback_returning_wchar_t ():
17451768 BInt = new_primitive_type ("int" )
17461769 BWChar = new_primitive_type ("wchar_t" )
@@ -2310,6 +2333,8 @@ def _test_wchar_variant(typename):
23102333 assert str (q ) == repr (q )
23112334 pytest .raises (RuntimeError , string , q )
23122335 #
2336+ if is_ios :
2337+ return # cannot allocate executable memory for the callback() below
23132338 def cb (p ):
23142339 assert repr (p ).startswith ("<cdata '%s *' 0x" % typename )
23152340 return len (string (p ))
@@ -2546,6 +2571,7 @@ def test_errno():
25462571 f (); f ()
25472572 assert get_errno () == 95
25482573
2574+ @pytest .mark .skipif (is_ios , reason = "Cannot allocate executable memory on iOS" )
25492575def test_errno_callback ():
25502576 if globals ().get ('PY_DOT_PY' ):
25512577 pytest .skip ("cannot run this test on py.py (e.g. fails on Windows)" )
@@ -2996,6 +3022,11 @@ def test_string_assignment_to_byte_array():
29963022 except ImportError :
29973023 pass # win32
29983024
3025+ @pytest .mark .skipif (
3026+ is_ios ,
3027+ reason = "For an unknown reason fscanf() doesn't read anything on 3.14"
3028+ " and crashes on 3.13 (that's why it's not an xfail)" ,
3029+ )
29993030def test_FILE ():
30003031 if sys .platform == "win32" :
30013032 pytest .skip ("testing FILE not implemented" )
0 commit comments