-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_all.py
More file actions
executable file
·197 lines (159 loc) · 5.53 KB
/
run_all.py
File metadata and controls
executable file
·197 lines (159 loc) · 5.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/usr/bin/env python3.10
""" Runner for CPython 3.10 test suite comparing against Nuitka.
Not every test of CPython has to pass, but instead it should fail just
the same with Nuitka.
"""
import os
import sys
# Find nuitka package relative to us.
sys.path.insert(
0,
os.path.normpath(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..")
),
)
# isort:start
from nuitka.tools.testing.Common import (
addToPythonPath,
compareWithCPython,
createSearchMode,
reportSkip,
setup,
setupCacheHashSalt,
)
def checkPath(dirname, filename):
# Complex stuff, pylint: disable=too-many-branches,too-many-return-statements
extra_flags = [
"remove_output",
# Import test_support which won't be included and potentially others.
"binary_python_path",
# We mean to compile only that one module
"recurse_none",
# Keep us informed about timing, even if concurrent runs spoil the
# accuracy.
"timing",
# Use the original __file__ value, at least one case warns about things
# with filename included.
"original_file",
# Cache the CPython results for reuse, they will normally not change.
"cpython_cache",
# Need to provide version, to know if to disable frozen modules.
"--python-version=%s" % ".".join(str(d) for d in python_version),
]
# TODO: This deadlocks, likely a threading problem.
if python_version >= (3, 4) and filename == "test_concurrent_futures.py":
reportSkip("Skipping (due to threading issue)", dirname, filename)
return
if dirname == "doctest_generated":
if python_version >= (3, 10):
extra_flags.append("expect_success")
if filename == "test_generators.py":
extra_flags.append("ignore_stderr")
# On Windows with 32 bit, the MemoryError breaks the test
if os.name == "nt":
reportSkip(
"not enough memory with 32 bits on Windows", dirname, filename
)
return
if filename in ("test_platform.py", "test_dataclasses.py", "test_asyncgen.py"):
extra_flags.append("ignore_stderr")
# TODO: Delayed, get it to work.
if filename == "test_exceptions.py":
reportSkip("KNOWN BUGGY", dirname, filename)
return
if filename == "test_datetime.py":
extra_flags.append("recurse_to:test.datetimetester")
if filename == "test_contextlib_async.py":
# Task warnings
extra_flags.append("ignore_stderr")
if python_version < (3, 10):
if filename in (
"test_abc.py",
"test_os.py",
"test_ast.py",
"test_fstring.py",
"test_functools.py",
"test_grammar.py",
"test_named_expressions.py",
"test_positional_only_arg.py",
"test_inspect.py",
"test_call.py",
"test_dataclasses.py",
"test_types.py",
):
reportSkip("Not useful with older Python", dirname, filename)
return
# Traceback differences
if filename == "test_dict.py":
extra_flags.append("ignore_stderr")
if filename == "test_dictcomps.py":
extra_flags.append("ignore_stderr")
# Outputs dict versions which are different.
if filename == "test_dict_version.py":
extra_flags.append("ignore_stderr")
elif python_version >= (3, 11):
if filename in (
"test_ast.py",
"test_capi.py",
"test_code.py",
"test_descrtut.py",
"test_netrc.py",
"test_ntpath.py",
"test_reprlib.py",
"test_tarfile.py",
"test_tempfile.py",
"test_threading.py",
"test_traceback.py",
"test_tracemalloc.py",
"test_shelve.py",
"test_sqlite.py",
"test_wsgiref.py",
"test_sys.py",
):
reportSkip("Not useful with newer Python", dirname, filename)
return
if filename == "test_gc.py":
reportSkip(
"Nuitka passes more tests with compiled 3.11 than CPython 3.11",
dirname,
filename,
)
return
else:
# Put 3.10 specific stuff here.
if filename == "test_capi.py":
reportSkip(
"Many details mismatch due to CPython 3.9 checking C stacks",
dirname,
filename,
)
return
if filename in ("test_grammar.py",):
reportSkip(
"Many details mismatch due to CPython 3.9 checking C stacks",
dirname,
filename,
)
return
compareWithCPython(
dirname=dirname,
filename=filename,
extra_flags=extra_flags,
search_mode=search_mode,
)
def checkDir(dirname):
for filename in sorted(os.listdir(dirname)):
if not filename.endswith(".py") or not filename.startswith("test_"):
continue
if filename == "test_support.py":
continue
active = search_mode.consider(dirname, filename)
if active:
checkPath(dirname, filename)
python_version = setup(suite="CPython310", needs_io_encoding=True)
setupCacheHashSalt(".")
search_mode = createSearchMode()
addToPythonPath(os.path.abspath("."), in_front=True)
checkDir("test")
checkDir("doctest_generated")
search_mode.finish()