File tree Expand file tree Collapse file tree 3 files changed +111
-5
lines changed
tests/testbed/src/testbed Expand file tree Collapse file tree 3 files changed +111
-5
lines changed Original file line number Diff line number Diff line change 1
1
###########################################################################
2
2
# Common tests
3
3
###########################################################################
4
+ import importlib
4
5
import os
5
6
6
7
from .utils import assert_
7
8
8
9
10
+ def test_bootstrap_modules ():
11
+ "All the bootstrap modules are importable"
12
+ missing = []
13
+
14
+ # The list of bootstrap modules that don't have explicit tests.
15
+ for module in [
16
+ '_abc' ,
17
+ '_codecs' ,
18
+ '_collections' ,
19
+ '_functools' ,
20
+ '_io' ,
21
+ '_locale' ,
22
+ '_operator' ,
23
+ '_signal' ,
24
+ '_sre' ,
25
+ '_stat' ,
26
+ '_symtable' ,
27
+ '_thread' ,
28
+ '_tracemalloc' ,
29
+ '_weakref' ,
30
+ 'atexit' ,
31
+ 'errno' ,
32
+ 'faulthandler' ,
33
+ 'itertools' ,
34
+ 'posix' ,
35
+ 'pwd' ,
36
+ 'time' ,
37
+ ]:
38
+ try :
39
+ importlib .import_module (module )
40
+ except ModuleNotFoundError :
41
+ missing .append (module )
42
+
43
+ assert_ (len (missing ) == 0 , msg = f"Missing bootstrap modules: { ', ' .join (str (m ) for m in missing )} " )
44
+
45
+
46
+ def test_stdlib_modules ():
47
+ "All the stdlib modules exist"
48
+ missing = []
49
+ for module in [
50
+ "_asyncio" ,
51
+ "_bisect" ,
52
+ "_codecs_cn" ,
53
+ "_codecs_hk" ,
54
+ "_codecs_iso2022" ,
55
+ "_codecs_jp" ,
56
+ "_codecs_kr" ,
57
+ "_codecs_tw" ,
58
+ "_contextvars" ,
59
+ "_csv" ,
60
+ "_datetime" ,
61
+ "_heapq" ,
62
+ "_json" ,
63
+ "_lsprof" ,
64
+ "_multibytecodec" ,
65
+ "_multiprocessing" ,
66
+ "_opcode" ,
67
+ "_pickle" ,
68
+ "_posixsubprocess" ,
69
+ "_queue" ,
70
+ "_random" ,
71
+ "_socket" ,
72
+ "_statistics" ,
73
+ "_struct" ,
74
+ "_typing" ,
75
+ "_uuid" ,
76
+ "array" ,
77
+ "binascii" ,
78
+ "cmath" ,
79
+ "fcntl" ,
80
+ "grp" ,
81
+ "math" ,
82
+ "mmap" ,
83
+ "resource" ,
84
+ "select" ,
85
+ "syslog" ,
86
+ "termios" ,
87
+ "unicodedata" ,
88
+ "zlib" ,
89
+ # Scheduled for deprecation
90
+ "_crypt" ,
91
+ "audioop" ,
92
+ ]:
93
+ try :
94
+ importlib .import_module (module )
95
+ except ModuleNotFoundError :
96
+ missing .append (module )
97
+
98
+ assert_ (len (missing ) == 0 , msg = f"Missing stdlib modules: { ', ' .join (str (m ) for m in missing )} " )
99
+
100
+
9
101
def test_bzip2 ():
10
102
"BZip2 compression with the bz2 module works"
11
103
import bz2
Original file line number Diff line number Diff line change 1
1
###########################################################################
2
2
# macOS specific tests
3
3
###########################################################################
4
+ import importlib
5
+
4
6
from .utils import assert_
5
7
6
8
@@ -49,3 +51,18 @@ def test_posix_subprocess():
49
51
50
52
result = subprocess .run (["uname" , "-s" ], capture_output = True )
51
53
assert_ (result .stdout == b"Darwin\n " )
54
+
55
+
56
+ def test_stdlib_modules ():
57
+ "All the macOS-specific stdlib modules exist"
58
+ missing = []
59
+ for module in [
60
+ "_posixshmem" ,
61
+ "_scproxy" ,
62
+ ]:
63
+ try :
64
+ importlib .import_module (module )
65
+ except ModuleNotFoundError :
66
+ missing .append (module )
67
+
68
+ assert_ (len (missing ) == 0 , msg = f"Missing stdlib modules: { ', ' .join (str (m ) for m in missing )} " )
Original file line number Diff line number Diff line change 1
- import errno
2
-
3
1
from rubicon .objc import ObjCClass
4
2
5
3
from .utils import assert_
@@ -19,6 +17,5 @@ def test_subprocess():
19
17
try :
20
18
subprocess .call (['uname' , '-a' ])
21
19
raise AssertionError ('Subprocesses should not be possible' )
22
- except OSError as e :
23
- assert_ (e .errno == errno .ENOTSUP )
24
- assert_ (str (e ) == "[Errno 45] ios does not support processes." )
20
+ except RuntimeError as e :
21
+ assert_ (str (e ) == "Subprocesses are not supported on ios" )
You can’t perform that action at this time.
0 commit comments