-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_all.py
executable file
·174 lines (133 loc) · 5.01 KB
/
run_all.py
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
#!/usr/bin/env python3.3
""" Runner for CPython 3.3 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,
my_print,
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 re-use, they will normally not change.
"cpython_cache",
# Never use multiprocessing plugin, these are false alarms.
"plugin_disable:multiprocessing",
]
# Avoid memory runaway of CPython2.
if (
dirname == "doctest_generated"
and filename == "test_itertools.py"
and python_version < (3,)
):
reportSkip("This triggers memory error with CPython2.x", dirname, filename)
return
if python_version < (3,):
# Order of syntax errors found is not the same. Encoding errors often
# overtake print function despite it being statement in Python2 errors-
if filename in ("test_locale.py", "test_xml_etree.py"):
extra_flags.append("ignore_stderr")
if filename == "test_buffer.py":
extra_flags.append("ignore_stderr")
# Imports a module with syntax errors.
if filename == "test_pep3120.py":
extra_flags.append("ignore_warnings")
# Imports missing packages we cannot whitelist.
if filename in ("test_pkgutil.py", "test_threaded_import.py"):
extra_flags.append("ignore_warnings")
if filename in ("test_concurrent_futures.py", "test_logging"):
# Plugins not needed.
extra_flags.append("ignore_warnings")
if os.name == "nt" and filename == "test_univnewlines.py":
reportSkip("this causes MemoryError for unknown reasons.", dirname, filename)
return
if dirname == "doctest_generated":
if python_version >= (3, 3):
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 python_version >= (3, 4):
if filename == "test_argparse.py":
my_print("Skipped, compilation takes too long for unknown reasons.")
return
if filename == "test_pep263.py":
my_print("Skipped, CPython refuses to decode for no apparent reason.")
return
if filename == "test_pkg.py":
my_print("Skipped, CPython fails with random output.")
return
if filename == "test_gettext.py":
my_print("Skipped, older CPython fails to remove files after test.")
return
if python_version < (3, 3):
# Can output warnings in debug mode on older CPython at least.
if filename == "test_sax.py":
extra_flags.append("ignore_stderr")
if python_version < (2, 7):
# Different syntax errors are OK.
if filename == "test_configparser.py":
extra_flags.append("ignore_stderr")
compareWithCPython(
dirname=dirname,
filename=filename,
extra_flags=extra_flags,
search_mode=search_mode,
needs_2to3=False,
)
def checkDir(dirname):
for filename in sorted(os.listdir(dirname)):
if not filename.startswith("test_"):
continue
if filename == "test_support.py":
continue
fullname = os.path.join(dirname, filename)
if os.path.isfile(fullname):
if not filename.endswith(".py"):
continue
else:
if not os.path.isfile(os.path.join(fullname, "__main__.py")):
continue
checkDir(fullname)
continue
active = search_mode.consider(dirname, filename)
if active:
checkPath(dirname, filename)
python_version = setup(suite="CPython33", needs_io_encoding=True)
setupCacheHashSalt(".")
search_mode = createSearchMode()
addToPythonPath(os.path.abspath("."), in_front=True)
checkDir("test")
checkDir("doctest_generated")