Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9b50585

Browse filesBrowse files
authored
gh-90473: Skip tests that don't apply to Emscripten and WASI (GH-92846)
1 parent fa2b8b7 commit 9b50585
Copy full SHA for 9b50585

14 files changed

+49
-24
lines changed

‎Lib/test/support/__init__.py

Copy file name to clipboardExpand all lines: Lib/test/support/__init__.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def requires_subprocess():
521521
"""Used for subprocess, os.spawn calls, fd inheritance"""
522522
return unittest.skipUnless(has_subprocess_support, "requires subprocess support")
523523

524-
# Emscripten's socket emulation has limitation. WASI doesn't have sockets yet.
524+
# Emscripten's socket emulation and WASI sockets have limitations.
525525
has_socket_support = not is_emscripten and not is_wasi
526526

527527
def requires_working_socket(*, module=False):

‎Lib/test/test__locale.py

Copy file name to clipboardExpand all lines: Lib/test/test__locale.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def numeric_tester(self, calc_type, calc_value, data_type, used_locale):
109109

110110
@unittest.skipUnless(nl_langinfo, "nl_langinfo is not available")
111111
@unittest.skipIf(
112-
support.is_emscripten, "musl libc issue on Emscripten, bpo-46390"
112+
support.is_emscripten or support.is_wasi,
113+
"musl libc issue on Emscripten, bpo-46390"
113114
)
114115
def test_lc_numeric_nl_langinfo(self):
115116
# Test nl_langinfo against known values
@@ -128,7 +129,8 @@ def test_lc_numeric_nl_langinfo(self):
128129
self.skipTest('no suitable locales')
129130

130131
@unittest.skipIf(
131-
support.is_emscripten, "musl libc issue on Emscripten, bpo-46390"
132+
support.is_emscripten or support.is_wasi,
133+
"musl libc issue on Emscripten, bpo-46390"
132134
)
133135
def test_lc_numeric_localeconv(self):
134136
# Test localeconv against known values

‎Lib/test/test_cmd_line_script.py

Copy file name to clipboardExpand all lines: Lib/test/test_cmd_line_script.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,9 @@ def test_non_ascii(self):
558558
# Mac OS X denies the creation of a file with an invalid UTF-8 name.
559559
# Windows allows creating a name with an arbitrary bytes name, but
560560
# Python cannot a undecodable bytes argument to a subprocess.
561+
# WASI does not permit invalid UTF-8 names.
561562
if (os_helper.TESTFN_UNDECODABLE
562-
and sys.platform not in ('win32', 'darwin')):
563+
and sys.platform not in ('win32', 'darwin', 'emscripten', 'wasi')):
563564
name = os.fsdecode(os_helper.TESTFN_UNDECODABLE)
564565
elif os_helper.TESTFN_NONASCII:
565566
name = os_helper.TESTFN_NONASCII

‎Lib/test/test_coroutines.py

Copy file name to clipboardExpand all lines: Lib/test/test_coroutines.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2209,7 +2209,8 @@ async def f():
22092209

22102210

22112211
@unittest.skipIf(
2212-
support.is_emscripten, "asyncio does not work under Emscripten yet."
2212+
support.is_emscripten or support.is_wasi,
2213+
"asyncio does not work under Emscripten/WASI yet."
22132214
)
22142215
class CoroAsyncIOCompatTest(unittest.TestCase):
22152216

‎Lib/test/test_genericpath.py

Copy file name to clipboardExpand all lines: Lib/test/test_genericpath.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ def test_nonascii_abspath(self):
484484
# invalid UTF-8 name. Windows allows creating a directory with an
485485
# arbitrary bytes name, but fails to enter this directory
486486
# (when the bytes name is used).
487-
and sys.platform not in ('win32', 'darwin', 'emscripten')):
487+
and sys.platform not in ('win32', 'darwin', 'emscripten', 'wasi')):
488488
name = os_helper.TESTFN_UNDECODABLE
489489
elif os_helper.TESTFN_NONASCII:
490490
name = os_helper.TESTFN_NONASCII

‎Lib/test/test_inspect.py

Copy file name to clipboardExpand all lines: Lib/test/test_inspect.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,10 @@ def test_nested_class_definition_inside_function(self):
842842
self.assertSourceEqual(mod2.cls213, 218, 222)
843843
self.assertSourceEqual(mod2.cls213().func219(), 220, 221)
844844

845-
@unittest.skipIf(support.is_emscripten, "socket.accept is broken")
845+
@unittest.skipIf(
846+
support.is_emscripten or support.is_wasi,
847+
"socket.accept is broken"
848+
)
846849
def test_nested_class_definition_inside_async_function(self):
847850
import asyncio
848851
self.addCleanup(asyncio.set_event_loop_policy, None)

‎Lib/test/test_locale.py

Copy file name to clipboardExpand all lines: Lib/test/test_locale.py
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from decimal import Decimal
2-
from test.support import verbose, is_android, is_emscripten
2+
from test.support import verbose, is_android, is_emscripten, is_wasi
33
from test.support.warnings_helper import check_warnings
44
import unittest
55
import locale
@@ -373,13 +373,19 @@ def setUp(self):
373373

374374
@unittest.skipIf(sys.platform.startswith('aix'),
375375
'bpo-29972: broken test on AIX')
376-
@unittest.skipIf(is_emscripten, "musl libc issue on Emscripten, bpo-46390")
376+
@unittest.skipIf(
377+
is_emscripten or is_wasi,
378+
"musl libc issue on Emscripten/WASI, bpo-46390"
379+
)
377380
def test_strcoll_with_diacritic(self):
378381
self.assertLess(locale.strcoll('à', 'b'), 0)
379382

380383
@unittest.skipIf(sys.platform.startswith('aix'),
381384
'bpo-29972: broken test on AIX')
382-
@unittest.skipIf(is_emscripten, "musl libc issue on Emscripten, bpo-46390")
385+
@unittest.skipIf(
386+
is_emscripten or is_wasi,
387+
"musl libc issue on Emscripten/WASI, bpo-46390"
388+
)
383389
def test_strxfrm_with_diacritic(self):
384390
self.assertLess(locale.strxfrm('à'), locale.strxfrm('b'))
385391

‎Lib/test/test_pydoc.py

Copy file name to clipboardExpand all lines: Lib/test/test_pydoc.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
from test.support.script_helper import assert_python_ok, assert_python_failure
2828
from test.support import threading_helper
2929
from test.support import (reap_children, captured_output, captured_stdout,
30-
captured_stderr, is_emscripten, requires_docstrings)
30+
captured_stderr, is_emscripten, is_wasi,
31+
requires_docstrings)
3132
from test.support.os_helper import (TESTFN, rmtree, unlink)
3233
from test import pydoc_mod
3334

@@ -1356,7 +1357,10 @@ def a_fn_with_https_link():
13561357
)
13571358

13581359

1359-
@unittest.skipIf(is_emscripten, "Socket server not available on Emscripten.")
1360+
@unittest.skipIf(
1361+
is_emscripten or is_wasi,
1362+
"Socket server not available on Emscripten/WASI."
1363+
)
13601364
class PydocServerTest(unittest.TestCase):
13611365
"""Tests for pydoc._start_server"""
13621366

‎Lib/test/test_pyexpat.py

Copy file name to clipboardExpand all lines: Lib/test/test_pyexpat.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from xml.parsers import expat
1313
from xml.parsers.expat import errors
1414

15-
from test.support import sortdict, is_emscripten
15+
from test.support import sortdict, is_emscripten, is_wasi
1616

1717

1818
class SetAttributeTest(unittest.TestCase):
@@ -469,6 +469,7 @@ def test_exception(self):
469469
if (sysconfig.is_python_build()
470470
and not (sys.platform == 'win32' and platform.machine() == 'ARM')
471471
and not is_emscripten
472+
and not is_wasi
472473
):
473474
self.assertIn('call_with_frame("StartElement"', entries[1][3])
474475

‎Lib/test/test_re.py

Copy file name to clipboardExpand all lines: Lib/test/test_re.py
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from test.support import (gc_collect, bigmemtest, _2G,
22
cpython_only, captured_stdout,
3-
check_disallow_instantiation, is_emscripten)
3+
check_disallow_instantiation, is_emscripten, is_wasi)
44
import locale
55
import re
66
import string
@@ -1943,7 +1943,10 @@ def test_bug_20998(self):
19431943
# with ignore case.
19441944
self.assertEqual(re.fullmatch('[a-c]+', 'ABC', re.I).span(), (0, 3))
19451945

1946-
@unittest.skipIf(is_emscripten, "musl libc issue on Emscripten, bpo-46390")
1946+
@unittest.skipIf(
1947+
is_emscripten or is_wasi,
1948+
"musl libc issue on Emscripten/WASI, bpo-46390"
1949+
)
19471950
def test_locale_caching(self):
19481951
# Issue #22410
19491952
oldlocale = locale.setlocale(locale.LC_CTYPE)
@@ -1980,7 +1983,10 @@ def check_en_US_utf8(self):
19801983
self.assertIsNone(re.match(b'(?Li)\xc5', b'\xe5'))
19811984
self.assertIsNone(re.match(b'(?Li)\xe5', b'\xc5'))
19821985

1983-
@unittest.skipIf(is_emscripten, "musl libc issue on Emscripten, bpo-46390")
1986+
@unittest.skipIf(
1987+
is_emscripten or is_wasi,
1988+
"musl libc issue on Emscripten/WASI, bpo-46390"
1989+
)
19841990
def test_locale_compiled(self):
19851991
oldlocale = locale.setlocale(locale.LC_CTYPE)
19861992
self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale)

‎Lib/test/test_robotparser.py

Copy file name to clipboardExpand all lines: Lib/test/test_robotparser.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,9 @@ def log_message(self, format, *args):
308308
pass
309309

310310

311-
@unittest.skipIf(
312-
support.is_emscripten, "Socket server not available on Emscripten."
311+
@unittest.skipUnless(
312+
support.has_socket_support,
313+
"Socket server requires working socket."
313314
)
314315
class PasswordProtectedSiteTestCase(unittest.TestCase):
315316

‎Lib/test/test_selectors.py

Copy file name to clipboardExpand all lines: Lib/test/test_selectors.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
resource = None
2020

2121

22-
if support.is_emscripten:
23-
raise unittest.SkipTest("Cannot create socketpair on Emscripten.")
22+
if support.is_emscripten or support.is_wasi:
23+
raise unittest.SkipTest("Cannot create socketpair on Emscripten/WASI.")
2424

2525

2626
if hasattr(socket, 'socketpair'):

‎Lib/test/test_support.py

Copy file name to clipboardExpand all lines: Lib/test/test_support.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def test_print_warning(self):
691691
'Warning -- a\nWarning -- b\n')
692692

693693
def test_has_strftime_extensions(self):
694-
if support.is_emscripten or support.is_wasi or sys.platform == "win32":
694+
if support.is_emscripten or sys.platform == "win32":
695695
self.assertFalse(support.has_strftime_extensions)
696696
else:
697697
self.assertTrue(support.has_strftime_extensions)

‎Lib/test/test_venv.py

Copy file name to clipboardExpand all lines: Lib/test/test_venv.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import tempfile
1717
from test.support import (captured_stdout, captured_stderr, requires_zlib,
1818
skip_if_broken_multiprocessing_synchronize, verbose,
19-
requires_subprocess, is_emscripten,
19+
requires_subprocess, is_emscripten, is_wasi,
2020
requires_venv_with_pip)
2121
from test.support.os_helper import (can_symlink, EnvironmentVarGuard, rmtree)
2222
import unittest
@@ -35,8 +35,8 @@
3535
or sys._base_executable != sys.executable,
3636
'cannot run venv.create from within a venv on this platform')
3737

38-
if is_emscripten:
39-
raise unittest.SkipTest("venv is not available on Emscripten.")
38+
if is_emscripten or is_wasi:
39+
raise unittest.SkipTest("venv is not available on Emscripten/WASI.")
4040

4141
@requires_subprocess()
4242
def check_output(cmd, encoding=None):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.