Skip to content

Commit e87dc93

Browse files
committed
Disable NEED_MODULES
* Replace hasattr(os, name) check for sys.platform check. * List disabled extensions on Apple mobile and on Emscripten
1 parent 2da05cd commit e87dc93

1 file changed

Lines changed: 139 additions & 100 deletions

File tree

‎Lib/test/libregrtest/skipped.py‎

Lines changed: 139 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -45,53 +45,14 @@
4545

4646
# List of tests expected to be skipped
4747
EXPECTED_SKIP = set()
48-
if support.MS_WINDOWS:
49-
EXPECTED_SKIP |= {
50-
# UNIX only
51-
'test_asyncio.test_unix_events',
52-
# test_gdb doesn't work on Windows
53-
'test_gdb',
54-
# Can't test signal on Windows
55-
'test_threadsignals',
56-
}
57-
else:
58-
EXPECTED_SKIP |= {
59-
# Tests specific to Windows
60-
'test_asyncio.test_windows_events',
61-
'test_asyncio.test_windows_utils',
62-
'test_msvcrt',
63-
'test_os.test_windows',
64-
'test_winapi',
65-
'test_winconsoleio',
66-
'test_winreg',
67-
'test_winsound',
68-
'test_wmi',
69-
}
70-
71-
if sys.platform in ("win32", 'darwin'):
72-
EXPECTED_SKIP.add('test_multiprocessing_fork')
73-
if sys.platform in ("win32", "cygwin"):
74-
EXPECTED_SKIP.add('test_multiprocessing_forkserver')
7548

7649
if support.Py_GIL_DISABLED:
50+
# Need GIL build
7751
EXPECTED_SKIP.add('test_interpreters')
7852
else:
53+
# Need Free Threading build
7954
EXPECTED_SKIP.add('test_free_threading')
8055

81-
if not hasattr(os, 'startfile'):
82-
EXPECTED_SKIP.add('test_startfile')
83-
if not hasattr(os, "openpty"):
84-
EXPECTED_SKIP.add('test_openpty')
85-
if not hasattr(os, "wait3"):
86-
EXPECTED_SKIP.add('test_wait3')
87-
if not hasattr(os, "wait4"):
88-
EXPECTED_SKIP.add('test_wait4')
89-
90-
if not support.is_android:
91-
EXPECTED_SKIP.add('test_android')
92-
if not support.is_apple:
93-
EXPECTED_SKIP.add('test_apple')
94-
9556
if not support.has_socket_support or IS_WASI:
9657
# Need socket support
9758
EXPECTED_SKIP |= {
@@ -139,30 +100,108 @@
139100
'test_subprocess',
140101
'test_tools',
141102
}
103+
if not support.has_fork_support or IS_WASI:
104+
# Need fork
105+
EXPECTED_SKIP |= {
106+
'test_fork1',
107+
'test_multiprocessing_forkserver',
108+
'test_wait3',
109+
'test_wait4',
110+
}
111+
112+
113+
if support.MS_WINDOWS:
114+
# Tests specific to non-Windows platforms
115+
EXPECTED_SKIP |= {
116+
'test_asyncio.test_unix_events', # UNIX only
117+
'test_dbm_gnu', # Need dbm.gnu module
118+
'test_dbm_ndbm', # Need dbm.ndbm module
119+
'test_fcntl', # Need fcntl module
120+
'test_free_threading.test_dbm_gnu', # Need dbm.gnu module
121+
'test_free_threading.test_grp', # Need grp module
122+
'test_free_threading.test_pwd', # Need pwd module
123+
'test_free_threading.test_readline', # Need readline module
124+
'test_free_threading.test_resource', # Need resource module
125+
'test_free_threading.test_syslog', # Need syslog module
126+
'test_gdb', # test_gdb doesn't work on Windows
127+
'test_grp', # Need grp module
128+
'test_ioctl', # Need fcntl module
129+
'test_openpty', # Need os.openpty()
130+
'test_pty', # Need termios module
131+
'test_pwd', # Need pwd module
132+
'test_readline', # Need readline module
133+
'test_resource', # Need resource module
134+
'test_syslog', # Need syslog module
135+
'test_termios', # Need termios module
136+
'test_threadsignals', # Can't test signal on Windows
137+
'test_tty', # Need termios and tty modules
138+
'test_wait3', # Need os.wait3()
139+
'test_wait4', # Need os.wait4()
140+
}
141+
else:
142+
EXPECTED_SKIP |= {
143+
# Tests specific to Windows
144+
'test_asyncio.test_windows_events',
145+
'test_asyncio.test_windows_utils',
146+
'test_msvcrt',
147+
'test_os.test_windows',
148+
'test_startfile', # Need os.startfile()
149+
'test_winapi',
150+
'test_winconsoleio',
151+
'test_winreg',
152+
'test_winsound',
153+
'test_wmi',
154+
}
155+
if sys.platform in ("win32", 'darwin'):
156+
EXPECTED_SKIP.add('test_multiprocessing_fork')
157+
if sys.platform in ("win32", "cygwin"):
158+
EXPECTED_SKIP.add('test_multiprocessing_forkserver')
159+
160+
if not support.is_android:
161+
EXPECTED_SKIP.add('test_android')
162+
if not support.is_apple:
163+
EXPECTED_SKIP.add('test_apple')
164+
165+
if support.is_apple_mobile:
166+
# configure disables multiple extension modules on Apple mobile
167+
EXPECTED_SKIP |= {
168+
'test_curses', # need _curses
169+
'test_grp', # need grp
170+
'test_syslog', # need syslog
171+
}
172+
EXPECTED_SKIP |= NEED_MULTIPROCESSING
173+
142174
if support.is_emscripten:
175+
# configure disables multiple extension modules on Emscripten
176+
EXPECTED_SKIP |= {
177+
'test__interpchannels', # need _interpchannels
178+
'test__interpreters', # need _interpreters
179+
'test_crossinterp', # need _interpreters
180+
'test_curses', # need _curses
181+
'test_grp', # need grp
182+
'test_pwd', # need pwd
183+
'test_resource', # need resource
184+
'test_syslog', # need syslog
185+
}
143186
EXPECTED_SKIP |= {
144187
# Incompatible with Emscripten's mmap emulation
145188
'test_mmap',
146189
# Cannot create socketpair on Emscripten/WASI
147190
'test_selectors',
148191
}
192+
149193
if support.is_android or support.is_apple_mobile or support.is_wasm32 or IS_WASI:
150194
EXPECTED_SKIP |= {
151195
# pty is not available on these platforms
152196
'test_pty',
153197
# venv is not available on these platforms
154198
'test_venv',
155199
}
200+
156201
# On FreeBSD, is_remote_debug_enabled() is always false
157202
if not sys.is_remote_debug_enabled():
158203
EXPECTED_SKIP.add('test_remote_pdb')
159-
if not support.has_fork_support or IS_WASI:
160-
EXPECTED_SKIP |= {
161-
'test_fork1',
162-
'test_multiprocessing_forkserver',
163-
'test_wait3',
164-
'test_wait4',
165-
}
204+
166205
if IS_WASI:
167206
EXPECTED_SKIP |= {
168207
# configure disables multiple extension modules on WASI
@@ -207,51 +246,51 @@
207246
EXPECTED_SKIP |= NEED_SSL
208247

209248

210-
# Modules needed by a test.
211-
# Used to check if a test is expected to be skipped.
212-
# NEED_MODULES doesn't work on WASI, since the main regrtest process is run
213-
# on the build Python which is different than the host (WASI) Python.
214-
NEED_MODULES = {
215-
'test__interpchannels': '_interpchannels',
216-
'test__interpreters': '_interpreters',
217-
'test_crossinterp': '_interpreters',
218-
'test_curses': ('_curses', 'curses', 'curses.ascii', 'curses.textpad'),
219-
'test_dbm_gnu': 'dbm.gnu',
220-
'test_dbm_ndbm': 'dbm.ndbm',
221-
'test_fcntl': 'fcntl',
222-
'test_free_threading.test_dbm_gnu': 'dbm.gnu',
223-
'test_free_threading.test_grp': 'grp',
224-
'test_free_threading.test_pwd': 'pwd',
225-
'test_free_threading.test_readline': 'readline',
226-
'test_free_threading.test_resource': 'resource',
227-
'test_free_threading.test_syslog': 'syslog',
228-
'test_grp': 'grp',
229-
'test_ioctl': ('fcntl', 'termios'),
230-
'test_lzma': '_lzma',
231-
'test_pty': 'termios',
232-
'test_pwd': 'pwd',
233-
'test_readline': 'readline',
234-
'test_resource': 'resource',
235-
'test_syslog': 'syslog',
236-
'test_termios': 'termios',
237-
'test_tty': ('termios', 'tty'),
238-
'test_xxlimited': 'xxlimited',
239-
'test_xxtestfuzz': '_xxtestfuzz',
240-
'test_zstd': '_zstd',
241-
}
242-
for name in NEED_MULTIPROCESSING:
243-
NEED_MODULES[name] = '_multiprocessing'
244-
for name in (
245-
'test_idle',
246-
'test_tcl',
247-
'test_tkinter',
248-
'test_ttk',
249-
'test_ttk_textonly',
250-
'test_turtle',
251-
):
252-
NEED_MODULES[name] = '_tkinter'
253-
for name in NEED_SSL:
254-
NEED_MODULES[name] = '_ssl'
249+
## # Modules needed by a test.
250+
## # Used to check if a test is expected to be skipped.
251+
## # NEED_MODULES doesn't work on WASI, since the main regrtest process is run
252+
## # on the build Python which is different than the host (WASI) Python.
253+
## NEED_MODULES = {
254+
## 'test__interpchannels': '_interpchannels',
255+
## 'test__interpreters': '_interpreters',
256+
## 'test_crossinterp': '_interpreters',
257+
## 'test_curses': ('_curses', 'curses', 'curses.ascii', 'curses.textpad'),
258+
## 'test_dbm_gnu': 'dbm.gnu',
259+
## 'test_dbm_ndbm': 'dbm.ndbm',
260+
## 'test_fcntl': 'fcntl',
261+
## 'test_free_threading.test_dbm_gnu': 'dbm.gnu',
262+
## 'test_free_threading.test_grp': 'grp',
263+
## 'test_free_threading.test_pwd': 'pwd',
264+
## 'test_free_threading.test_readline': 'readline',
265+
## 'test_free_threading.test_resource': 'resource',
266+
## 'test_free_threading.test_syslog': 'syslog',
267+
## 'test_grp': 'grp',
268+
## 'test_ioctl': ('fcntl', 'termios'),
269+
## 'test_lzma': '_lzma',
270+
## 'test_pty': 'termios',
271+
## 'test_pwd': 'pwd',
272+
## 'test_readline': 'readline',
273+
## 'test_resource': 'resource',
274+
## 'test_syslog': 'syslog',
275+
## 'test_termios': 'termios',
276+
## 'test_tty': ('termios', 'tty'),
277+
## 'test_xxlimited': 'xxlimited',
278+
## 'test_xxtestfuzz': '_xxtestfuzz',
279+
## 'test_zstd': '_zstd',
280+
## }
281+
## for name in NEED_MULTIPROCESSING:
282+
## NEED_MODULES[name] = '_multiprocessing'
283+
## for name in (
284+
## 'test_idle',
285+
## 'test_tcl',
286+
## 'test_tkinter',
287+
## 'test_ttk',
288+
## 'test_ttk_textonly',
289+
## 'test_turtle',
290+
## ):
291+
## NEED_MODULES[name] = '_tkinter'
292+
## for name in NEED_SSL:
293+
## NEED_MODULES[name] = '_ssl'
255294

256295

257296
NEED_WORKING_THREADING = {
@@ -285,13 +324,13 @@ def expected_to_be_skipped(test_name):
285324
if package in EXPECTED_SKIP:
286325
return True
287326

288-
# Test NEED_MODULES
289-
if test_name in NEED_MODULES:
290-
if miss_modules(NEED_MODULES[test_name]):
291-
return True
292-
elif package in NEED_MODULES:
293-
if miss_modules(NEED_MODULES[package]):
294-
return True
327+
## # Test NEED_MODULES
328+
## if test_name in NEED_MODULES:
329+
## if miss_modules(NEED_MODULES[test_name]):
330+
## return True
331+
## elif package in NEED_MODULES:
332+
## if miss_modules(NEED_MODULES[package]):
333+
## return True
295334

296335
# Custom ruleset
297336
if (test_name in NEED_WORKING_THREADING

0 commit comments

Comments
 (0)