Skip to content

Commit d305f40

Browse files
committed
Merge branch 'dev' into 3.10
2 parents ce0ed90 + 1ffb5d8 commit d305f40

File tree

3 files changed

+110
-5
lines changed

3 files changed

+110
-5
lines changed

tests/testbed/src/testbed/common.py

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,102 @@
11
###########################################################################
22
# Common tests
33
###########################################################################
4+
import importlib
45
import os
56

67
from .utils import assert_
78

89

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+
"_uuid",
75+
"array",
76+
"binascii",
77+
"cmath",
78+
"fcntl",
79+
"grp",
80+
"math",
81+
"mmap",
82+
"resource",
83+
"select",
84+
"syslog",
85+
"termios",
86+
"unicodedata",
87+
"zlib",
88+
# Scheduled for deprecation
89+
"_crypt",
90+
"audioop",
91+
]:
92+
try:
93+
importlib.import_module(module)
94+
except ModuleNotFoundError:
95+
missing.append(module)
96+
97+
assert_(len(missing) == 0, msg=f"Missing stdlib modules: {', '.join(str(m) for m in missing)}")
98+
99+
9100
def test_bzip2():
10101
"BZip2 compression with the bz2 module works"
11102
import bz2

tests/testbed/src/testbed/darwin.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
###########################################################################
22
# macOS specific tests
33
###########################################################################
4+
import importlib
5+
46
from .utils import assert_
57

68

@@ -49,3 +51,18 @@ def test_posix_subprocess():
4951

5052
result = subprocess.run(["uname", "-s"], capture_output=True)
5153
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)}")

tests/testbed/src/testbed/ios.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import errno
2-
31
from rubicon.objc import ObjCClass
42

53
from .utils import assert_
@@ -19,6 +17,5 @@ def test_subprocess():
1917
try:
2018
subprocess.call(['uname', '-a'])
2119
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")

0 commit comments

Comments
 (0)