|
40 | 40 | "bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute", |
41 | 41 | "requires_IEEE_754", "requires_zlib", |
42 | 42 | "has_fork_support", "requires_fork", |
| 43 | + "has_subprocess_support", "requires_subprocess", |
43 | 44 | "anticipate_failure", "load_package_tests", "detect_api_mismatch", |
44 | 45 | "check__all__", "skip_if_buggy_ucrt_strfptime", |
45 | 46 | "check_disallow_instantiation", |
46 | 47 | # sys |
47 | | - "is_jython", "is_android", "is_emscripten", |
| 48 | + "is_jython", "is_android", "is_emscripten", "is_wasi", |
48 | 49 | "check_impl_detail", "unix_shell", "setswitchinterval", |
49 | 50 | # network |
50 | 51 | "open_urlresource", |
@@ -467,15 +468,23 @@ def requires_debug_ranges(reason='requires co_positions / debug_ranges'): |
467 | 468 | else: |
468 | 469 | unix_shell = None |
469 | 470 |
|
470 | | -# 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. |
472 | 473 | is_emscripten = sys.platform == "emscripten" |
| 474 | +is_wasi = sys.platform == "wasi" |
473 | 475 |
|
474 | | -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 |
475 | 477 |
|
476 | 478 | def requires_fork(): |
477 | 479 | return unittest.skipUnless(has_fork_support, "requires working os.fork()") |
478 | 480 |
|
| 481 | +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 | + |
479 | 488 | # Define the URL of a dedicated HTTP server for the network tests. |
480 | 489 | # The URL must use clear-text HTTP: no redirection to encrypted HTTPS. |
481 | 490 | TEST_HTTP_URL = "http://www.pythontest.net" |
|
0 commit comments