gh-90473: Skip tests that don't apply to Emscripten and WASI (GH-92846)

This commit is contained in:
Christian Heimes 2022-05-16 16:02:37 +02:00 committed by GitHub
parent fa2b8b75eb
commit 9b50585e02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 49 additions and 24 deletions

View file

@ -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):

View file

@ -109,7 +109,8 @@ class _LocaleTests(unittest.TestCase):
@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 @@ class _LocaleTests(unittest.TestCase):
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

View file

@ -558,8 +558,9 @@ class CmdLineTest(unittest.TestCase):
# 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

View file

@ -2209,7 +2209,8 @@ class CoroutineTest(unittest.TestCase):
@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):

View file

@ -484,7 +484,7 @@ class CommonTest(GenericTest):
# 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

View file

@ -842,7 +842,10 @@ class TestBuggyCases(GetSourceBase):
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)

View file

@ -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 @@ class TestEnUSCollation(BaseLocalizedTest, TestCollation):
@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'))

View file

@ -27,7 +27,8 @@ from test.support import os_helper
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 @@ foo
)
@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"""

View file

@ -12,7 +12,7 @@ import traceback
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 @@ class HandlerExceptionTest(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])

View file

@ -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 @@ class ReTests(unittest.TestCase):
# 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 @@ class ReTests(unittest.TestCase):
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)

View file

@ -308,8 +308,9 @@ class RobotHandler(BaseHTTPRequestHandler):
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):

View file

@ -19,8 +19,8 @@ except ImportError:
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'):

View file

@ -691,7 +691,7 @@ class TestSupport(unittest.TestCase):
'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)

View file

@ -16,7 +16,7 @@ import sys
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 @@ requireVenvCreate = unittest.skipUnless(
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):