43
43
"requires_limited_api" , "requires_specialization" ,
44
44
# sys
45
45
"MS_WINDOWS" , "is_jython" , "is_android" , "is_emscripten" , "is_wasi" ,
46
- "check_impl_detail" , "unix_shell" , "setswitchinterval" ,
46
+ "is_apple_mobile" , " check_impl_detail" , "unix_shell" , "setswitchinterval" ,
47
47
# os
48
48
"get_pagesize" ,
49
49
# network
@@ -531,7 +531,7 @@ def requires_legacy_unicode_capi():
531
531
532
532
is_android = hasattr (sys , 'getandroidapilevel' )
533
533
534
- if sys .platform not in ( ' win32' , ' vxworks' ) :
534
+ if sys .platform not in { " win32" , " vxworks" , "ios" , "tvos" , "watchos" } :
535
535
unix_shell = '/system/bin/sh' if is_android else '/bin/sh'
536
536
else :
537
537
unix_shell = None
@@ -541,19 +541,35 @@ def requires_legacy_unicode_capi():
541
541
is_emscripten = sys .platform == "emscripten"
542
542
is_wasi = sys .platform == "wasi"
543
543
544
- has_fork_support = hasattr (os , "fork" ) and not is_emscripten and not is_wasi
544
+ # Apple mobile platforms (iOS/tvOS/watchOS) are POSIX-like but do not
545
+ # have subprocess or fork support.
546
+ is_apple_mobile = sys .platform in {"ios" , "tvos" , "watchos" }
547
+ is_apple = is_apple_mobile or sys .platform == "darwin"
548
+
549
+ has_fork_support = hasattr (os , "fork" ) and not (
550
+ is_emscripten
551
+ or is_wasi
552
+ or is_apple_mobile
553
+ )
545
554
546
555
def requires_fork ():
547
556
return unittest .skipUnless (has_fork_support , "requires working os.fork()" )
548
557
549
- has_subprocess_support = not is_emscripten and not is_wasi
558
+ has_subprocess_support = not (
559
+ is_emscripten
560
+ or is_wasi
561
+ or is_apple_mobile
562
+ )
550
563
551
564
def requires_subprocess ():
552
565
"""Used for subprocess, os.spawn calls, fd inheritance"""
553
566
return unittest .skipUnless (has_subprocess_support , "requires subprocess support" )
554
567
555
568
# Emscripten's socket emulation and WASI sockets have limitations.
556
- has_socket_support = not is_emscripten and not is_wasi
569
+ has_socket_support = not (
570
+ is_emscripten
571
+ or is_wasi
572
+ )
557
573
558
574
def requires_working_socket (* , module = False ):
559
575
"""Skip tests or modules that require working sockets
0 commit comments