summaryrefslogtreecommitdiffstats
path: root/Lib/test/support/__init__.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-01-25 07:09:06 (GMT)
committerGitHub <noreply@github.com>2022-01-25 07:09:06 (GMT)
commit8464fbc42ecc9ce504faac499711dcdc6eedef16 (patch)
tree1992e76c83da4720bc1dbc95901a417e0a4781e3 /Lib/test/support/__init__.py
parente1abffca45b60729c460e3e2ad50c8c1946cfd4e (diff)
downloadcpython-8464fbc42ecc9ce504faac499711dcdc6eedef16.zip
cpython-8464fbc42ecc9ce504faac499711dcdc6eedef16.tar.gz
cpython-8464fbc42ecc9ce504faac499711dcdc6eedef16.tar.bz2
bpo-40280: Skip subprocess-based tests on wasm32-emscripten (GH-30615)
Diffstat (limited to 'Lib/test/support/__init__.py')
-rw-r--r--Lib/test/support/__init__.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index ca903d3..1e4935f 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -40,11 +40,12 @@ __all__ = [
"bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute",
"requires_IEEE_754", "requires_zlib",
"has_fork_support", "requires_fork",
+ "has_subprocess_support", "requires_subprocess",
"anticipate_failure", "load_package_tests", "detect_api_mismatch",
"check__all__", "skip_if_buggy_ucrt_strfptime",
"check_disallow_instantiation",
# sys
- "is_jython", "is_android", "is_emscripten",
+ "is_jython", "is_android", "is_emscripten", "is_wasi",
"check_impl_detail", "unix_shell", "setswitchinterval",
# network
"open_urlresource",
@@ -467,15 +468,23 @@ if sys.platform not in ('win32', 'vxworks'):
else:
unix_shell = None
-# wasm32-emscripten is POSIX-like but does not provide a
-# working fork() or subprocess API.
+# wasm32-emscripten and -wasi are POSIX-like but do not
+# have subprocess or fork support.
is_emscripten = sys.platform == "emscripten"
+is_wasi = sys.platform == "wasi"
-has_fork_support = hasattr(os, "fork") and not is_emscripten
+has_fork_support = hasattr(os, "fork") and not is_emscripten and not is_wasi
def requires_fork():
return unittest.skipUnless(has_fork_support, "requires working os.fork()")
+has_subprocess_support = not is_emscripten and not is_wasi
+
+def requires_subprocess():
+ """Used for subprocess, os.spawn calls"""
+ return unittest.skipUnless(has_subprocess_support, "requires subprocess support")
+
+
# Define the URL of a dedicated HTTP server for the network tests.
# The URL must use clear-text HTTP: no redirection to encrypted HTTPS.
TEST_HTTP_URL = "http://www.pythontest.net"