|
6 | 6 | import importlib |
7 | 7 | import os |
8 | 8 | import sys |
| 9 | +import sysconfig |
9 | 10 | from test import support |
10 | 11 |
|
11 | 12 |
|
|
51 | 52 | 'test_threading_local', |
52 | 53 | 'test_webbrowser', |
53 | 54 | } |
| 55 | +NEED_TKINTER = { |
| 56 | + 'test_idle', |
| 57 | + 'test_tcl', |
| 58 | + 'test_tkinter', |
| 59 | + 'test_ttk', |
| 60 | + 'test_ttk_textonly', |
| 61 | + 'test_turtle', |
| 62 | +} |
54 | 63 |
|
55 | 64 |
|
56 | 65 | # List of tests expected to be skipped on sys.platform |
|
92 | 101 | # Need subprocess support |
93 | 102 | EXPECTED_SKIP |= { |
94 | 103 | 'test_argparse', |
| 104 | + 'test_asyncio.test_subprocess', |
95 | 105 | 'test_c_stack_unwind', |
96 | 106 | 'test_cext', |
97 | 107 | 'test_clinic', |
|
121 | 131 | if not(sys.platform in ("linux", "darwin") or support.MS_WINDOWS): |
122 | 132 | # Need Py_SUPPORTS_REMOTE_DEBUG macro |
123 | 133 | EXPECTED_SKIP.add('test_remote_pdb') |
| 134 | +if not sysconfig.is_python_build(): |
| 135 | + # Skip tests on installed Python. |
| 136 | + # Tests only relevant for from-source Python builds |
| 137 | + EXPECTED_SKIP |= { |
| 138 | + # Parser/asdl.py is not installed |
| 139 | + 'test_asdl_parser', |
| 140 | + # Tools/clinic/ is not installed |
| 141 | + 'test_clinic', |
| 142 | + # Tools/cases_generator is not installed |
| 143 | + 'test_generated_cases', |
| 144 | + } |
| 145 | +if not sysconfig.get_config_var('WITH_DTRACE'): |
| 146 | + # Need ./configure --with-dtrace |
| 147 | + EXPECTED_SKIP.add('test_dtrace') |
124 | 148 |
|
125 | 149 | if support.MS_WINDOWS: |
126 | 150 | # Tests specific to non-Windows platforms |
|
171 | 195 |
|
172 | 196 | if not support.is_android: |
173 | 197 | EXPECTED_SKIP.add('test_android') |
| 198 | + # _multiprocessing is not available on Android |
| 199 | + EXPECTED_SKIP |= NEED_MULTIPROCESSING |
| 200 | + # _tkinter is not available on Android |
| 201 | + EXPECTED_SKIP |= NEED_TKINTER |
| 202 | + |
174 | 203 | if not support.is_apple: |
175 | 204 | EXPECTED_SKIP.add('test_apple') |
176 | 205 |
|
|
181 | 210 | 'test_grp', # need grp |
182 | 211 | 'test_syslog', # need syslog |
183 | 212 | } |
| 213 | + # configure disables _multiprocessing on Apple mobile |
184 | 214 | EXPECTED_SKIP |= NEED_MULTIPROCESSING |
| 215 | + # configure disables _tkinter on Apple mobile |
| 216 | + EXPECTED_SKIP |= NEED_TKINTER |
185 | 217 |
|
186 | 218 | if support.is_emscripten: |
187 | 219 | # configure disables multiple extension modules on Emscripten |
|
195 | 227 | 'test_resource', # need resource |
196 | 228 | 'test_syslog', # need syslog |
197 | 229 | } |
| 230 | + # configure disables _multiprocessing on Emscripten |
| 231 | + EXPECTED_SKIP |= NEED_MULTIPROCESSING |
198 | 232 | EXPECTED_SKIP |= { |
199 | 233 | # Incompatible with Emscripten's mmap emulation |
200 | 234 | 'test_mmap', |
201 | 235 | # Cannot create socketpair on Emscripten/WASI |
202 | 236 | 'test_selectors', |
203 | 237 | } |
| 238 | + # Missing OpenSSL dependency on Emscripten |
| 239 | + EXPECTED_SKIP |= NEED_SSL |
| 240 | + # Missing Tcl/Tk dependency on Emscripten |
| 241 | + EXPECTED_SKIP |= NEED_TKINTER |
204 | 242 |
|
205 | 243 | if support.is_android or support.is_apple_mobile or support.is_wasm32 or IS_WASI: |
206 | 244 | EXPECTED_SKIP |= { |
|
252 | 290 | EXPECTED_SKIP |= NEED_TESTMULTIPHASE |
253 | 291 | # Missing OpenSSL dependency on WASI |
254 | 292 | EXPECTED_SKIP |= NEED_SSL |
| 293 | + # Missing Tcl/Tk dependency on WASI |
| 294 | + EXPECTED_SKIP |= NEED_TKINTER |
| 295 | + # Missing libreadline/libedit dependency on Emscripten |
| 296 | + EXPECTED_SKIP.add('readline') |
255 | 297 |
|
256 | 298 |
|
257 | 299 | def expected_to_be_skipped(test_name): |
@@ -281,20 +323,10 @@ def expected_to_be_skipped(test_name): |
281 | 323 | name = test_name.removeprefix('test_') |
282 | 324 | return not hasattr(select, name) |
283 | 325 |
|
284 | | - if test_name == 'test_dtrace': |
285 | | - # Need ./configure --with-dtrace |
286 | | - import sysconfig |
287 | | - return not sysconfig.get_config_var('WITH_DTRACE') |
288 | | - |
289 | 326 | if test_name in ('test_perf_profiler', 'test_perfmaps', 'test_samply_profiler'): |
290 | 327 | # Need perf trampoline profiling: configure defines the |
291 | 328 | # PY_HAVE_PERF_TRAMPOLINE macro on Linux (x86-64 and AArch64) |
292 | 329 | # and on macOS. |
293 | 330 | return not support.supports_perf_trampoline_profiling() |
294 | 331 |
|
295 | | - if test_name == 'test_asdl_parser': |
296 | | - # Test only relevant for from-source Python builds |
297 | | - import sysconfig |
298 | | - return not sysconfig.is_python_build() |
299 | | - |
300 | 332 | return False |
0 commit comments