summaryrefslogtreecommitdiffstats
path: root/Lib/test/support/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/support/__init__.py')
-rw-r--r--Lib/test/support/__init__.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index f8faa41..ca903d3 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -39,12 +39,13 @@ __all__ = [
"requires_gzip", "requires_bz2", "requires_lzma",
"bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute",
"requires_IEEE_754", "requires_zlib",
+ "has_fork_support", "requires_fork",
"anticipate_failure", "load_package_tests", "detect_api_mismatch",
"check__all__", "skip_if_buggy_ucrt_strfptime",
"check_disallow_instantiation",
# sys
- "is_jython", "is_android", "check_impl_detail", "unix_shell",
- "setswitchinterval",
+ "is_jython", "is_android", "is_emscripten",
+ "check_impl_detail", "unix_shell", "setswitchinterval",
# network
"open_urlresource",
# processes
@@ -466,6 +467,15 @@ 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.
+is_emscripten = sys.platform == "emscripten"
+
+has_fork_support = hasattr(os, "fork") and not is_emscripten
+
+def requires_fork():
+ return unittest.skipUnless(has_fork_support, "requires working os.fork()")
+
# 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"