summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2024-02-05 00:04:57 (GMT)
committerGitHub <noreply@github.com>2024-02-05 00:04:57 (GMT)
commit391659b3da570bfa28fed5fbdb6f2d9c26ab3dd0 (patch)
tree19d4bd5693a55e06e3ab4a88826e284a1e9717ae /Lib/test/test_asyncio
parent15f6f048a6ecdf0f6f4fc076d013be3d110f8ed6 (diff)
downloadcpython-391659b3da570bfa28fed5fbdb6f2d9c26ab3dd0.zip
cpython-391659b3da570bfa28fed5fbdb6f2d9c26ab3dd0.tar.gz
cpython-391659b3da570bfa28fed5fbdb6f2d9c26ab3dd0.tar.bz2
gh-114099: Add test exclusions to support running the test suite on iOS (#114889)
Add test annotations required to run the test suite on iOS (PEP 730). The majority of the change involve annotating tests that use subprocess, but are skipped on Emscripten/WASI for other reasons, and including iOS/tvOS/watchOS under the same umbrella as macOS/darwin checks. `is_apple` and `is_apple_mobile` test helpers have been added to identify *any* Apple platform, and "any Apple platform except macOS", respectively.
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_events.py14
-rw-r--r--Lib/test/test_asyncio/test_streams.py3
-rw-r--r--Lib/test/test_asyncio/test_subprocess.py2
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py2
4 files changed, 19 insertions, 2 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index b25c097..c92c88b 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -1815,6 +1815,7 @@ class SubprocessTestsMixin:
else:
self.assertEqual(-signal.SIGKILL, returncode)
+ @support.requires_subprocess()
def test_subprocess_exec(self):
prog = os.path.join(os.path.dirname(__file__), 'echo.py')
@@ -1836,6 +1837,7 @@ class SubprocessTestsMixin:
self.check_killed(proto.returncode)
self.assertEqual(b'Python The Winner', proto.data[1])
+ @support.requires_subprocess()
def test_subprocess_interactive(self):
prog = os.path.join(os.path.dirname(__file__), 'echo.py')
@@ -1863,6 +1865,7 @@ class SubprocessTestsMixin:
self.loop.run_until_complete(proto.completed)
self.check_killed(proto.returncode)
+ @support.requires_subprocess()
def test_subprocess_shell(self):
connect = self.loop.subprocess_shell(
functools.partial(MySubprocessProtocol, self.loop),
@@ -1879,6 +1882,7 @@ class SubprocessTestsMixin:
self.assertEqual(proto.data[2], b'')
transp.close()
+ @support.requires_subprocess()
def test_subprocess_exitcode(self):
connect = self.loop.subprocess_shell(
functools.partial(MySubprocessProtocol, self.loop),
@@ -1890,6 +1894,7 @@ class SubprocessTestsMixin:
self.assertEqual(7, proto.returncode)
transp.close()
+ @support.requires_subprocess()
def test_subprocess_close_after_finish(self):
connect = self.loop.subprocess_shell(
functools.partial(MySubprocessProtocol, self.loop),
@@ -1904,6 +1909,7 @@ class SubprocessTestsMixin:
self.assertEqual(7, proto.returncode)
self.assertIsNone(transp.close())
+ @support.requires_subprocess()
def test_subprocess_kill(self):
prog = os.path.join(os.path.dirname(__file__), 'echo.py')
@@ -1920,6 +1926,7 @@ class SubprocessTestsMixin:
self.check_killed(proto.returncode)
transp.close()
+ @support.requires_subprocess()
def test_subprocess_terminate(self):
prog = os.path.join(os.path.dirname(__file__), 'echo.py')
@@ -1937,6 +1944,7 @@ class SubprocessTestsMixin:
transp.close()
@unittest.skipIf(sys.platform == 'win32', "Don't have SIGHUP")
+ @support.requires_subprocess()
def test_subprocess_send_signal(self):
# bpo-31034: Make sure that we get the default signal handler (killing
# the process). The parent process may have decided to ignore SIGHUP,
@@ -1961,6 +1969,7 @@ class SubprocessTestsMixin:
finally:
signal.signal(signal.SIGHUP, old_handler)
+ @support.requires_subprocess()
def test_subprocess_stderr(self):
prog = os.path.join(os.path.dirname(__file__), 'echo2.py')
@@ -1982,6 +1991,7 @@ class SubprocessTestsMixin:
self.assertTrue(proto.data[2].startswith(b'ERR:test'), proto.data[2])
self.assertEqual(0, proto.returncode)
+ @support.requires_subprocess()
def test_subprocess_stderr_redirect_to_stdout(self):
prog = os.path.join(os.path.dirname(__file__), 'echo2.py')
@@ -2007,6 +2017,7 @@ class SubprocessTestsMixin:
transp.close()
self.assertEqual(0, proto.returncode)
+ @support.requires_subprocess()
def test_subprocess_close_client_stream(self):
prog = os.path.join(os.path.dirname(__file__), 'echo3.py')
@@ -2041,6 +2052,7 @@ class SubprocessTestsMixin:
self.loop.run_until_complete(proto.completed)
self.check_killed(proto.returncode)
+ @support.requires_subprocess()
def test_subprocess_wait_no_same_group(self):
# start the new process in a new session
connect = self.loop.subprocess_shell(
@@ -2053,6 +2065,7 @@ class SubprocessTestsMixin:
self.assertEqual(7, proto.returncode)
transp.close()
+ @support.requires_subprocess()
def test_subprocess_exec_invalid_args(self):
async def connect(**kwds):
await self.loop.subprocess_exec(
@@ -2066,6 +2079,7 @@ class SubprocessTestsMixin:
with self.assertRaises(ValueError):
self.loop.run_until_complete(connect(shell=True))
+ @support.requires_subprocess()
def test_subprocess_shell_invalid_args(self):
async def connect(cmd=None, **kwds):
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
index 3c8cc5f..2109905 100644
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -10,7 +10,6 @@ import threading
import unittest
from unittest import mock
import warnings
-from test.support import socket_helper
try:
import ssl
except ImportError:
@@ -18,6 +17,7 @@ except ImportError:
import asyncio
from test.test_asyncio import utils as test_utils
+from test.support import requires_subprocess, socket_helper
def tearDownModule():
@@ -770,6 +770,7 @@ class StreamTests(test_utils.TestCase):
self.assertEqual(msg2, b"hello world 2!\n")
@unittest.skipIf(sys.platform == 'win32', "Don't have pipes")
+ @requires_subprocess()
def test_read_all_from_pipe_reader(self):
# See asyncio issue 168. This test is derived from the example
# subprocess_attach_read_pipe.py, but we configure the
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
index 808b21c..f50a9eb 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -47,6 +47,7 @@ class TestSubprocessTransport(base_subprocess.BaseSubprocessTransport):
self._proc.pid = -1
+@support.requires_subprocess()
class SubprocessTransportTests(test_utils.TestCase):
def setUp(self):
super().setUp()
@@ -110,6 +111,7 @@ class SubprocessTransportTests(test_utils.TestCase):
transport.close()
+@support.requires_subprocess()
class SubprocessMixin:
def test_stdin_stdout(self):
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index d2c8cba..59ef9f5 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -1874,7 +1874,7 @@ class TestFunctional(unittest.TestCase):
wsock.close()
-@unittest.skipUnless(hasattr(os, 'fork'), 'requires os.fork()')
+@support.requires_fork()
class TestFork(unittest.IsolatedAsyncioTestCase):
async def test_fork_not_share_event_loop(self):