[Python-checkins] gh-90473: Skip tests that don't apply to Emscripten and WASI (GH-92846)
tiran
webhook-mailer at python.org
Mon May 16 10:02:55 EDT 2022
https://github.com/python/cpython/commit/9b50585e0225a80f9e383edacc7d73f1b5c8008b
commit: 9b50585e0225a80f9e383edacc7d73f1b5c8008b
branch: main
author: Christian Heimes <christian at python.org>
committer: tiran <christian at python.org>
date: 2022-05-16T16:02:37+02:00
summary:
gh-90473: Skip tests that don't apply to Emscripten and WASI (GH-92846)
files:
M Lib/test/support/__init__.py
M Lib/test/test__locale.py
M Lib/test/test_cmd_line_script.py
M Lib/test/test_coroutines.py
M Lib/test/test_genericpath.py
M Lib/test/test_inspect.py
M Lib/test/test_locale.py
M Lib/test/test_pydoc.py
M Lib/test/test_pyexpat.py
M Lib/test/test_re.py
M Lib/test/test_robotparser.py
M Lib/test/test_selectors.py
M Lib/test/test_support.py
M Lib/test/test_venv.py
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index bddfe118e369d..e4bda940b3dd6 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -521,7 +521,7 @@ def requires_subprocess():
"""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):
diff --git a/Lib/test/test__locale.py b/Lib/test/test__locale.py
index b3bc54cd55104..0947464bb8c04 100644
--- a/Lib/test/test__locale.py
+++ b/Lib/test/test__locale.py
@@ -109,7 +109,8 @@ def numeric_tester(self, calc_type, calc_value, data_type, used_locale):
@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
@@ -128,7 +129,8 @@ def test_lc_numeric_nl_langinfo(self):
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
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index bb433dc1e73a4..d783af65839ad 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -558,8 +558,9 @@ def test_non_ascii(self):
# 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
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index 77944e678c750..dba5ceffaf1c0 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -2209,7 +2209,8 @@ async def f():
@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):
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
index 2741adc139bcf..489044f8090d3 100644
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -484,7 +484,7 @@ def test_nonascii_abspath(self):
# 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
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index fe0259ab609c7..ae1842704d37d 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -842,7 +842,10 @@ def test_nested_class_definition_inside_function(self):
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)
diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py
index 5cb6edc52d777..bc8a7a35fbf2d 100644
--- a/Lib/test/test_locale.py
+++ b/Lib/test/test_locale.py
@@ -1,5 +1,5 @@
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
@@ -373,13 +373,19 @@ def setUp(self):
@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'))
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index 13c77b6fa6822..ac181effe49bb 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -27,7 +27,8 @@
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
@@ -1356,7 +1357,10 @@ def a_fn_with_https_link():
)
- at unittest.skipIf(is_emscripten, "Socket server not available on Emscripten.")
+ at unittest.skipIf(
+ is_emscripten or is_wasi,
+ "Socket server not available on Emscripten/WASI."
+)
class PydocServerTest(unittest.TestCase):
"""Tests for pydoc._start_server"""
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py
index 6e578458a2509..6f0441b66d9b8 100644
--- a/Lib/test/test_pyexpat.py
+++ b/Lib/test/test_pyexpat.py
@@ -12,7 +12,7 @@
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):
@@ -469,6 +469,7 @@ def test_exception(self):
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])
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index ba70de4344bd9..52ee616e210fb 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -1,6 +1,6 @@
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
@@ -1943,7 +1943,10 @@ def test_bug_20998(self):
# 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)
@@ -1980,7 +1983,10 @@ def check_en_US_utf8(self):
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)
diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py
index 3821d66c2db7d..8d89e2a822445 100644
--- a/Lib/test/test_robotparser.py
+++ b/Lib/test/test_robotparser.py
@@ -308,8 +308,9 @@ def log_message(self, format, *args):
pass
- at unittest.skipIf(
- support.is_emscripten, "Socket server not available on Emscripten."
+ at unittest.skipUnless(
+ support.has_socket_support,
+ "Socket server requires working socket."
)
class PasswordProtectedSiteTestCase(unittest.TestCase):
diff --git a/Lib/test/test_selectors.py b/Lib/test/test_selectors.py
index c927331d438b0..c2db88c203920 100644
--- a/Lib/test/test_selectors.py
+++ b/Lib/test/test_selectors.py
@@ -19,8 +19,8 @@
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'):
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index dce49809385c6..7a8b6819c5a91 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -691,7 +691,7 @@ def test_print_warning(self):
'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)
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index 4f897523907ef..9f2ecf3be644a 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -16,7 +16,7 @@
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
@@ -35,8 +35,8 @@
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):
More information about the Python-checkins
mailing list