bpo-40280: Skip subprocess-based tests on wasm32-emscripten (GH-30615) · python/cpython@8464fbc

@@ -40,11 +40,12 @@

4040

"bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute",

4141

"requires_IEEE_754", "requires_zlib",

4242

"has_fork_support", "requires_fork",

43+

"has_subprocess_support", "requires_subprocess",

4344

"anticipate_failure", "load_package_tests", "detect_api_mismatch",

4445

"check__all__", "skip_if_buggy_ucrt_strfptime",

4546

"check_disallow_instantiation",

4647

# sys

47-

"is_jython", "is_android", "is_emscripten",

48+

"is_jython", "is_android", "is_emscripten", "is_wasi",

4849

"check_impl_detail", "unix_shell", "setswitchinterval",

4950

# network

5051

"open_urlresource",

@@ -467,15 +468,23 @@ def requires_debug_ranges(reason='requires co_positions / debug_ranges'):

467468

else:

468469

unix_shell = None

469470470-

# wasm32-emscripten is POSIX-like but does not provide a

471-

# working fork() or subprocess API.

471+

# wasm32-emscripten and -wasi are POSIX-like but do not

472+

# have subprocess or fork support.

472473

is_emscripten = sys.platform == "emscripten"

474+

is_wasi = sys.platform == "wasi"

473475474-

has_fork_support = hasattr(os, "fork") and not is_emscripten

476+

has_fork_support = hasattr(os, "fork") and not is_emscripten and not is_wasi

475477476478

def requires_fork():

477479

return unittest.skipUnless(has_fork_support, "requires working os.fork()")

478480481+

has_subprocess_support = not is_emscripten and not is_wasi

482+483+

def requires_subprocess():

484+

"""Used for subprocess, os.spawn calls"""

485+

return unittest.skipUnless(has_subprocess_support, "requires subprocess support")

486+487+479488

# Define the URL of a dedicated HTTP server for the network tests.

480489

# The URL must use clear-text HTTP: no redirection to encrypted HTTPS.

481490

TEST_HTTP_URL = "http://www.pythontest.net"