"""Used for subprocess, os.spawn calls, fd inheritance"""
return unittest.skipUnless(has_subprocess_support, "requires subprocess support")
-# Emscripten's socket emulation has limitation. WASI doesn't have sockets yet.
+# Emscripten's socket emulation and WASI sockets have limitations.
has_socket_support = not is_emscripten and not is_wasi
def requires_working_socket(*, module=False):
@unittest.skipUnless(nl_langinfo, "nl_langinfo is not available")
@unittest.skipIf(
- support.is_emscripten, "musl libc issue on Emscripten, bpo-46390"
+ support.is_emscripten or support.is_wasi,
+ "musl libc issue on Emscripten, bpo-46390"
)
def test_lc_numeric_nl_langinfo(self):
# Test nl_langinfo against known values
self.skipTest('no suitable locales')
@unittest.skipIf(
- support.is_emscripten, "musl libc issue on Emscripten, bpo-46390"
+ support.is_emscripten or support.is_wasi,
+ "musl libc issue on Emscripten, bpo-46390"
)
def test_lc_numeric_localeconv(self):
# Test localeconv against known values
# Mac OS X denies the creation of a file with an invalid UTF-8 name.
# Windows allows creating a name with an arbitrary bytes name, but
# Python cannot a undecodable bytes argument to a subprocess.
+ # WASI does not permit invalid UTF-8 names.
if (os_helper.TESTFN_UNDECODABLE
- and sys.platform not in ('win32', 'darwin')):
+ and sys.platform not in ('win32', 'darwin', 'emscripten', 'wasi')):
name = os.fsdecode(os_helper.TESTFN_UNDECODABLE)
elif os_helper.TESTFN_NONASCII:
name = os_helper.TESTFN_NONASCII
@unittest.skipIf(
- support.is_emscripten, "asyncio does not work under Emscripten yet."
+ support.is_emscripten or support.is_wasi,
+ "asyncio does not work under Emscripten/WASI yet."
)
class CoroAsyncIOCompatTest(unittest.TestCase):
# invalid UTF-8 name. Windows allows creating a directory with an
# arbitrary bytes name, but fails to enter this directory
# (when the bytes name is used).
- and sys.platform not in ('win32', 'darwin', 'emscripten')):
+ and sys.platform not in ('win32', 'darwin', 'emscripten', 'wasi')):
name = os_helper.TESTFN_UNDECODABLE
elif os_helper.TESTFN_NONASCII:
name = os_helper.TESTFN_NONASCII
self.assertSourceEqual(mod2.cls213, 218, 222)
self.assertSourceEqual(mod2.cls213().func219(), 220, 221)
- @unittest.skipIf(support.is_emscripten, "socket.accept is broken")
+ @unittest.skipIf(
+ support.is_emscripten or support.is_wasi,
+ "socket.accept is broken"
+ )
def test_nested_class_definition_inside_async_function(self):
import asyncio
self.addCleanup(asyncio.set_event_loop_policy, None)
from decimal import Decimal
-from test.support import verbose, is_android, is_emscripten
+from test.support import verbose, is_android, is_emscripten, is_wasi
from test.support.warnings_helper import check_warnings
import unittest
import locale
@unittest.skipIf(sys.platform.startswith('aix'),
'bpo-29972: broken test on AIX')
- @unittest.skipIf(is_emscripten, "musl libc issue on Emscripten, bpo-46390")
+ @unittest.skipIf(
+ is_emscripten or is_wasi,
+ "musl libc issue on Emscripten/WASI, bpo-46390"
+ )
def test_strcoll_with_diacritic(self):
self.assertLess(locale.strcoll('à', 'b'), 0)
@unittest.skipIf(sys.platform.startswith('aix'),
'bpo-29972: broken test on AIX')
- @unittest.skipIf(is_emscripten, "musl libc issue on Emscripten, bpo-46390")
+ @unittest.skipIf(
+ is_emscripten or is_wasi,
+ "musl libc issue on Emscripten/WASI, bpo-46390"
+ )
def test_strxfrm_with_diacritic(self):
self.assertLess(locale.strxfrm('à'), locale.strxfrm('b'))
from test.support.script_helper import assert_python_ok, assert_python_failure
from test.support import threading_helper
from test.support import (reap_children, captured_output, captured_stdout,
- captured_stderr, is_emscripten, requires_docstrings)
+ captured_stderr, is_emscripten, is_wasi,
+ requires_docstrings)
from test.support.os_helper import (TESTFN, rmtree, unlink)
from test import pydoc_mod
)
-@unittest.skipIf(is_emscripten, "Socket server not available on Emscripten.")
+@unittest.skipIf(
+ is_emscripten or is_wasi,
+ "Socket server not available on Emscripten/WASI."
+)
class PydocServerTest(unittest.TestCase):
"""Tests for pydoc._start_server"""
from xml.parsers import expat
from xml.parsers.expat import errors
-from test.support import sortdict, is_emscripten
+from test.support import sortdict, is_emscripten, is_wasi
class SetAttributeTest(unittest.TestCase):
if (sysconfig.is_python_build()
and not (sys.platform == 'win32' and platform.machine() == 'ARM')
and not is_emscripten
+ and not is_wasi
):
self.assertIn('call_with_frame("StartElement"', entries[1][3])
from test.support import (gc_collect, bigmemtest, _2G,
cpython_only, captured_stdout,
- check_disallow_instantiation, is_emscripten)
+ check_disallow_instantiation, is_emscripten, is_wasi)
import locale
import re
import string
# with ignore case.
self.assertEqual(re.fullmatch('[a-c]+', 'ABC', re.I).span(), (0, 3))
- @unittest.skipIf(is_emscripten, "musl libc issue on Emscripten, bpo-46390")
+ @unittest.skipIf(
+ is_emscripten or is_wasi,
+ "musl libc issue on Emscripten/WASI, bpo-46390"
+ )
def test_locale_caching(self):
# Issue #22410
oldlocale = locale.setlocale(locale.LC_CTYPE)
self.assertIsNone(re.match(b'(?Li)\xc5', b'\xe5'))
self.assertIsNone(re.match(b'(?Li)\xe5', b'\xc5'))
- @unittest.skipIf(is_emscripten, "musl libc issue on Emscripten, bpo-46390")
+ @unittest.skipIf(
+ is_emscripten or is_wasi,
+ "musl libc issue on Emscripten/WASI, bpo-46390"
+ )
def test_locale_compiled(self):
oldlocale = locale.setlocale(locale.LC_CTYPE)
self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale)
pass
-@unittest.skipIf(
- support.is_emscripten, "Socket server not available on Emscripten."
+@unittest.skipUnless(
+ support.has_socket_support,
+ "Socket server requires working socket."
)
class PasswordProtectedSiteTestCase(unittest.TestCase):
resource = None
-if support.is_emscripten:
- raise unittest.SkipTest("Cannot create socketpair on Emscripten.")
+if support.is_emscripten or support.is_wasi:
+ raise unittest.SkipTest("Cannot create socketpair on Emscripten/WASI.")
if hasattr(socket, 'socketpair'):
'Warning -- a\nWarning -- b\n')
def test_has_strftime_extensions(self):
- if support.is_emscripten or support.is_wasi or sys.platform == "win32":
+ if support.is_emscripten or sys.platform == "win32":
self.assertFalse(support.has_strftime_extensions)
else:
self.assertTrue(support.has_strftime_extensions)
import tempfile
from test.support import (captured_stdout, captured_stderr, requires_zlib,
skip_if_broken_multiprocessing_synchronize, verbose,
- requires_subprocess, is_emscripten,
+ requires_subprocess, is_emscripten, is_wasi,
requires_venv_with_pip)
from test.support.os_helper import (can_symlink, EnvironmentVarGuard, rmtree)
import unittest
or sys._base_executable != sys.executable,
'cannot run venv.create from within a venv on this platform')
-if is_emscripten:
- raise unittest.SkipTest("venv is not available on Emscripten.")
+if is_emscripten or is_wasi:
+ raise unittest.SkipTest("venv is not available on Emscripten/WASI.")
@requires_subprocess()
def check_output(cmd, encoding=None):