11"""
22Ruleset to check if a test is expected to be skipped.
3+ Tests are mostly filtered using sys.platform, except a few exceptions.
34"""
45
56import importlib
4142 'test_pyclbr' ,
4243 'test_runpy' ,
4344}
45+ NEED_WORKING_THREADING = {
46+ 'test_concurrent_futures' ,
47+ 'test_queue' ,
48+ 'test_thread' ,
49+ 'test_threadedtempfile' ,
50+ 'test_threading' ,
51+ 'test_threading_local' ,
52+ 'test_webbrowser' ,
53+ }
4454
4555
46- # List of tests expected to be skipped
56+ # List of tests expected to be skipped on sys.platform
4757EXPECTED_SKIP = set ()
4858
4959if support .Py_GIL_DISABLED :
238248 }
239249 # configure disables _multiprocessing and _testmultiphase
240250 # extension modules on WASI
241- EXPECTED_SKIP |= NEED_TESTMULTIPHASE
242251 EXPECTED_SKIP |= NEED_MULTIPROCESSING
252+ EXPECTED_SKIP |= NEED_TESTMULTIPHASE
243253 # Missing OpenSSL dependency on WASI
244254 EXPECTED_SKIP |= NEED_SSL
245255
246256
247- ## # Modules needed by a test.
248- ## # Used to check if a test is expected to be skipped.
249- ## # NEED_MODULES doesn't work on WASI, since the main regrtest process is run
250- ## # on the build Python which is different than the host (WASI) Python.
251- ## NEED_MODULES = {
252- ## 'test__interpchannels': '_interpchannels',
253- ## 'test__interpreters': '_interpreters',
254- ## 'test_crossinterp': '_interpreters',
255- ## 'test_curses': ('_curses', 'curses', 'curses.ascii', 'curses.textpad'),
256- ## 'test_dbm_gnu': 'dbm.gnu',
257- ## 'test_dbm_ndbm': 'dbm.ndbm',
258- ## 'test_fcntl': 'fcntl',
259- ## 'test_free_threading.test_dbm_gnu': 'dbm.gnu',
260- ## 'test_free_threading.test_grp': 'grp',
261- ## 'test_free_threading.test_pwd': 'pwd',
262- ## 'test_free_threading.test_readline': 'readline',
263- ## 'test_free_threading.test_resource': 'resource',
264- ## 'test_free_threading.test_syslog': 'syslog',
265- ## 'test_grp': 'grp',
266- ## 'test_ioctl': ('fcntl', 'termios'),
267- ## 'test_lzma': '_lzma',
268- ## 'test_pty': 'termios',
269- ## 'test_pwd': 'pwd',
270- ## 'test_readline': 'readline',
271- ## 'test_resource': 'resource',
272- ## 'test_syslog': 'syslog',
273- ## 'test_termios': 'termios',
274- ## 'test_tty': ('termios', 'tty'),
275- ## 'test_xxlimited': 'xxlimited',
276- ## 'test_xxtestfuzz': '_xxtestfuzz',
277- ## 'test_zstd': '_zstd',
278- ## }
279- ## for name in NEED_MULTIPROCESSING:
280- ## NEED_MODULES[name] = '_multiprocessing'
281- ## for name in (
282- ## 'test_idle',
283- ## 'test_tcl',
284- ## 'test_tkinter',
285- ## 'test_ttk',
286- ## 'test_ttk_textonly',
287- ## 'test_turtle',
288- ## ):
289- ## NEED_MODULES[name] = '_tkinter'
290- ## for name in NEED_SSL:
291- ## NEED_MODULES[name] = '_ssl'
292-
293-
294- NEED_WORKING_THREADING = {
295- 'test_concurrent_futures' ,
296- 'test_queue' ,
297- 'test_thread' ,
298- 'test_threadedtempfile' ,
299- 'test_threading' ,
300- 'test_threading_local' ,
301- 'test_webbrowser' ,
302- }
303-
304-
305- def miss_modules (modules ):
306- if isinstance (modules , str ):
307- modules = (modules ,)
308- try :
309- for module in modules :
310- importlib .import_module (module )
311- except ImportError :
312- return True
313- return False
314-
315-
316257def expected_to_be_skipped (test_name ):
317258 # Test EXPECTED_SKIP
318259 test_name = test_name .removeprefix ('test.' )
@@ -322,14 +263,6 @@ def expected_to_be_skipped(test_name):
322263 if package in EXPECTED_SKIP :
323264 return True
324265
325- ## # Test NEED_MODULES
326- ## if test_name in NEED_MODULES:
327- ## if miss_modules(NEED_MODULES[test_name]):
328- ## return True
329- ## elif package in NEED_MODULES:
330- ## if miss_modules(NEED_MODULES[package]):
331- ## return True
332-
333266 # Custom ruleset
334267 if (test_name in NEED_WORKING_THREADING
335268 or package in NEED_WORKING_THREADING ):
@@ -359,11 +292,6 @@ def expected_to_be_skipped(test_name):
359292 # and on macOS.
360293 return not support .supports_perf_trampoline_profiling ()
361294
362- ## if package == 'test_gdb':
363- ## # Need gdb program
364- ## import shutil
365- ## return not shutil.which('gdb')
366-
367295 if test_name == 'test_asdl_parser' :
368296 # Test only relevant for from-source Python builds
369297 import sysconfig
0 commit comments