]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] Use `test.support.is_wasm32` flag for `is_emscripten` or `is_wasi` for generic...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 8 Sep 2025 13:20:00 +0000 (15:20 +0200)
committerGitHub <noreply@github.com>
Mon, 8 Sep 2025 13:20:00 +0000 (16:20 +0300)
Co-authored-by: Ani <5357586+anistark@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
Lib/test/pythoninfo.py
Lib/test/support/__init__.py
Lib/test/test_build_details.py
Lib/test/test_import/__init__.py
Lib/test/test_pathlib/test_pathlib.py
Lib/test/test_pty.py
Lib/test/test_pydoc/test_pydoc.py
Lib/test/test_support.py
Lib/test/test_venv.py

index 682815c3fdd6e0ebda2a5d98b3cf6c7a22788d0c..23e49772291b0d5132b2ba119e9c7455188c2762 100644 (file)
@@ -752,6 +752,7 @@ def collect_support(info_add):
         'is_emscripten',
         'is_jython',
         'is_wasi',
+        'is_wasm32',
     )
     copy_attributes(info_add, support, 'support.%s', attributes)
 
index cd7f406565771b964e84a52eb9800f59fc3a6fae..aab2645fb96307273eaac09f62ebce9a04338804 100644 (file)
@@ -574,6 +574,9 @@ else:
 is_emscripten = sys.platform == "emscripten"
 is_wasi = sys.platform == "wasi"
 
+# Use is_wasm32 as a generic check for WebAssembly platforms.
+is_wasm32 = is_emscripten or is_wasi
+
 def skip_emscripten_stack_overflow():
     return unittest.skipIf(is_emscripten, "Exhausts stack on Emscripten")
 
@@ -3154,7 +3157,7 @@ def linked_to_musl():
 
     # emscripten (at least as far as we're concerned) and wasi use musl,
     # but platform doesn't know how to get the version, so set it to zero.
-    if is_emscripten or is_wasi:
+    if is_wasm32:
         _linked_to_musl = (0, 0, 0)
         return _linked_to_musl
 
index 691fd0bb98c097896271f1478168b53afcc5b4e6..bc04963f5ad6137fcf1c5e9ac8c31064e8fd6540 100644 (file)
@@ -5,7 +5,7 @@ import sysconfig
 import string
 import unittest
 
-from test.support import is_android, is_apple_mobile, is_emscripten, is_wasi
+from test.support import is_android, is_apple_mobile, is_wasm32
 
 
 class FormatTestsBase:
@@ -91,7 +91,7 @@ needs_installed_python = unittest.skipIf(
 
 
 @unittest.skipIf(os.name != 'posix', 'Feature only implemented on POSIX right now')
-@unittest.skipIf(is_wasi or is_emscripten, 'Feature not available on WebAssembly builds')
+@unittest.skipIf(is_wasm32, 'Feature not available on WebAssembly builds')
 class CPythonBuildDetailsTests(unittest.TestCase, FormatTestsBase):
     """Test CPython's install details file implementation."""
 
index 6e34094c5aa422381a9404696ea7790b3064bc23..abbd5f1ed5f12f67e16217fb251404183c165028 100644 (file)
@@ -35,7 +35,7 @@ from test.support import (
     cpython_only,
     is_apple_mobile,
     is_emscripten,
-    is_wasi,
+    is_wasm32,
     run_in_subinterp,
     run_in_subinterp_with_config,
     Py_TRACE_REFS,
@@ -1257,7 +1257,7 @@ class FilePermissionTests(unittest.TestCase):
     @unittest.skipUnless(os.name == 'posix',
                          "test meaningful only on posix systems")
     @unittest.skipIf(
-        is_emscripten or is_wasi,
+        is_wasm32,
         "Emscripten's/WASI's umask is a stub."
     )
     def test_creation_mode(self):
index b2e2cdb3338beb464a7bddef22f517a40849d17d..177646724b0731f3ede2afa0b3c359b558605e3c 100644 (file)
@@ -17,7 +17,7 @@ from urllib.request import pathname2url
 
 from test.support import import_helper
 from test.support import cpython_only
-from test.support import is_emscripten, is_wasi
+from test.support import is_emscripten, is_wasi, is_wasm32
 from test.support import infinite_recursion
 from test.support import os_helper
 from test.support.os_helper import TESTFN, FS_NONASCII, FakePath
@@ -3164,7 +3164,7 @@ class PathTest(PurePathTest):
         self.assertEqual(str(P('//a/b').absolute()), '//a/b')
 
     @unittest.skipIf(
-        is_emscripten or is_wasi,
+        is_wasm32,
         "umask is not implemented on Emscripten/WASI."
     )
     @needs_posix
@@ -3195,7 +3195,7 @@ class PathTest(PurePathTest):
             os.chdir(current_directory)
 
     @unittest.skipIf(
-        is_emscripten or is_wasi,
+        is_wasm32,
         "umask is not implemented on Emscripten/WASI."
     )
     @needs_posix
index c1728f5019d042659b7055553ac9dd8485c56911..2dde84b54dd86f94d3d651c539d689a717d6a529 100644 (file)
@@ -1,6 +1,6 @@
 import unittest
 from test.support import (
-    is_android, is_apple_mobile, is_emscripten, is_wasi, reap_children, verbose
+    is_android, is_apple_mobile, is_wasm32, reap_children, verbose
 )
 from test.support.import_helper import import_module
 from test.support.os_helper import TESTFN, unlink
@@ -8,7 +8,7 @@ from test.support.os_helper import TESTFN, unlink
 # Skip these tests if termios is not available
 import_module('termios')
 
-if is_android or is_apple_mobile or is_emscripten or is_wasi:
+if is_android or is_apple_mobile or is_wasm32:
     raise unittest.SkipTest("pty is not available on this platform")
 
 import errno
index f5ba5e1eb754be029f0a88487c7dbd45e4159afa..7623930affe4fc27ed727838871dba3fd5c72731 100644 (file)
@@ -33,7 +33,7 @@ from test.support.script_helper import (assert_python_ok,
                                         assert_python_failure, spawn_python)
 from test.support import threading_helper
 from test.support import (reap_children, captured_stdout,
-                          captured_stderr, is_emscripten, is_wasi,
+                          captured_stderr, is_wasm32,
                           requires_docstrings, MISSING_C_DOCSTRINGS)
 from test.support.os_helper import (TESTFN, rmtree, unlink)
 from test.test_pydoc import pydoc_mod
@@ -2081,7 +2081,7 @@ class PydocFodderTest(unittest.TestCase):
 
 
 @unittest.skipIf(
-    is_emscripten or is_wasi,
+    is_wasm32,
     "Socket server not available on Emscripten/WASI."
 )
 class PydocServerTest(unittest.TestCase):
index e48a2464ee5977ee6561476dca3c5dc08383ec5b..e8d5e0d72e79c816db8f949bb40e267a8c32d4ee 100644 (file)
@@ -784,7 +784,7 @@ class TestSupport(unittest.TestCase):
     def test_linked_to_musl(self):
         linked = support.linked_to_musl()
         self.assertIsNotNone(linked)
-        if support.is_wasi or support.is_emscripten:
+        if support.is_wasm32:
             self.assertTrue(linked)
         # The value is cached, so make sure it returns the same value again.
         self.assertIs(linked, support.linked_to_musl())
index 12c30e178aeb51e7d87a414370290c410e0a9a9d..26f069dce2b807c398f6c05504b782226eecaf4e 100644 (file)
@@ -21,7 +21,7 @@ import shlex
 from test.support import (captured_stdout, captured_stderr,
                           skip_if_broken_multiprocessing_synchronize, verbose,
                           requires_subprocess, is_android, is_apple_mobile,
-                          is_emscripten, is_wasi,
+                          is_wasm32,
                           requires_venv_with_pip, TEST_HOME_DIR,
                           requires_resource, copy_python_src_ignore)
 from test.support.os_helper import (can_symlink, EnvironmentVarGuard, rmtree,
@@ -42,7 +42,7 @@ requireVenvCreate = unittest.skipUnless(
     or sys._base_executable != sys.executable,
     'cannot run venv.create from within a venv on this platform')
 
-if is_android or is_apple_mobile or is_emscripten or is_wasi:
+if is_android or is_apple_mobile or is_wasm32:
     raise unittest.SkipTest("venv is not available on this platform")
 
 @requires_subprocess()