Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40280: Skip socket, fork, subprocess tests on Emscripten #31986

Merged
merged 13 commits into from
Mar 22, 2022
Next Next commit
bpo-40280: Add requires_fork and subprocess to more tests
tiran committed Mar 19, 2022
commit 8c79de49b1640cf3d44be7b699f332284b080195
2 changes: 1 addition & 1 deletion Lib/test/lock_tests.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
from test.support import threading_helper


requires_fork = unittest.skipUnless(hasattr(os, 'fork'),
requires_fork = unittest.skipUnless(support.has_fork_support,
"platform doesn't support fork "
"(no _at_fork_reinit method)")

1 change: 1 addition & 0 deletions Lib/test/test_json/test_tool.py
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
from test.support.script_helper import assert_python_ok


@support.requires_subprocess()
class TestTool(unittest.TestCase):
data = """

2 changes: 1 addition & 1 deletion Lib/test/test_mailbox.py
Original file line number Diff line number Diff line change
@@ -1061,7 +1061,7 @@ def test_add_and_close(self):
self.assertEqual(contents, f.read())
self._box = self._factory(self._path)

@unittest.skipUnless(hasattr(os, 'fork'), "Test needs fork().")
@support.requires_fork()
@unittest.skipUnless(hasattr(socket, 'socketpair'), "Test needs socketpair().")
def test_lock_conflict(self):
# Fork off a child process that will lock the mailbox temporarily,
2 changes: 2 additions & 0 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@

from contextlib import ExitStack, redirect_stdout
from io import StringIO
from test import support
from test.support import os_helper
# This little helper class is essential for testing pdb under doctest.
from test.test_doctest import _FakeInput
@@ -1363,6 +1364,7 @@ def test_pdb_issue_43318():
"""


@support.requires_subprocess()
class PdbTestCase(unittest.TestCase):
def tearDown(self):
os_helper.unlink(os_helper.TESTFN)
1 change: 1 addition & 0 deletions Lib/test/test_peg_generator/test_c_parser.py
Original file line number Diff line number Diff line change
@@ -70,6 +70,7 @@ def test_parse(self):
"""


@support.requires_subprocess()
class TestCParser(unittest.TestCase):
def setUp(self):
self._backup_config_vars = dict(sysconfig._CONFIG_VARS)
2 changes: 1 addition & 1 deletion Lib/test/test_socketserver.py
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
HAVE_UNIX_SOCKETS = hasattr(socket, "AF_UNIX")
requires_unix_sockets = unittest.skipUnless(HAVE_UNIX_SOCKETS,
'requires Unix sockets')
HAVE_FORKING = hasattr(os, "fork")
HAVE_FORKING = test.support.has_fork_support
requires_forking = unittest.skipUnless(HAVE_FORKING, 'requires forking')

def signal_alarm(n):
4 changes: 4 additions & 0 deletions Lib/test/test_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -13,6 +13,10 @@
raise unittest.SkipTest("test too slow on ASAN/MSAN build")


if not support.has_subprocess_support:
raise unittest.SkipTest("test module requires subprocess")


basepath = os.path.normpath(
os.path.dirname( # <src/install dir>
os.path.dirname( # Lib
4 changes: 2 additions & 2 deletions Lib/test/test_wait3.py
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@
from test.fork_wait import ForkWait
from test import support

if not hasattr(os, 'fork'):
raise unittest.SkipTest("os.fork not defined")
if not support.has_fork_support:
raise unittest.SkipTest("requires working os.fork()")

if not hasattr(os, 'wait3'):
raise unittest.SkipTest("os.wait3 not defined")
4 changes: 3 additions & 1 deletion Lib/test/test_wait4.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,9 @@
from test import support

# If either of these do not exist, skip this test.
support.get_attribute(os, 'fork')
if not support.has_fork_support:
raise unittest.SkipTest("requires working os.fork()")

support.get_attribute(os, 'wait4')