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

gh-114099: Add test exclusions to support running the test suite on iOS #114889

Merged
merged 6 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarified some test exclusions.
  • Loading branch information
freakboy3742 committed Feb 3, 2024
commit 74803b1d8babbe6c0ddbc7517efdcab9bc532748
15 changes: 14 additions & 1 deletion Lib/test/test_asyncio/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,6 @@ async def test():
next(it)


@support.requires_subprocess()
class SubprocessTestsMixin:
freakboy3742 marked this conversation as resolved.
Show resolved Hide resolved

def check_terminated(self, returncode):
Expand All @@ -1816,6 +1815,7 @@ def check_killed(self, returncode):
else:
self.assertEqual(-signal.SIGKILL, returncode)

@support.requires_subprocess()
def test_subprocess_exec(self):
prog = os.path.join(os.path.dirname(__file__), 'echo.py')

Expand All @@ -1837,6 +1837,7 @@ def test_subprocess_exec(self):
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')

Expand Down Expand Up @@ -1864,6 +1865,7 @@ def test_subprocess_interactive(self):
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),
Expand All @@ -1880,6 +1882,7 @@ def test_subprocess_shell(self):
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),
Expand All @@ -1891,6 +1894,7 @@ def test_subprocess_exitcode(self):
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),
Expand All @@ -1905,6 +1909,7 @@ def test_subprocess_close_after_finish(self):
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')

Expand All @@ -1921,6 +1926,7 @@ def test_subprocess_kill(self):
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')

Expand All @@ -1938,6 +1944,7 @@ def test_subprocess_terminate(self):
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,
Expand All @@ -1962,6 +1969,7 @@ def test_subprocess_send_signal(self):
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')

Expand All @@ -1983,6 +1991,7 @@ def test_subprocess_stderr(self):
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')

Expand All @@ -2008,6 +2017,7 @@ def test_subprocess_stderr_redirect_to_stdout(self):
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')

Expand Down Expand Up @@ -2042,6 +2052,7 @@ def test_subprocess_close_client_stream(self):
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(
Expand All @@ -2054,6 +2065,7 @@ def test_subprocess_wait_no_same_group(self):
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(
Expand All @@ -2067,6 +2079,7 @@ async def connect(**kwds):
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):
Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_asyncio/test_unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1874,8 +1874,7 @@ async def runner():
wsock.close()


@unittest.skipUnless(hasattr(os, 'fork'), 'requires os.fork()')
@support.requires_subprocess()
@support.requires_fork()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Much cleaner.

class TestFork(unittest.IsolatedAsyncioTestCase):

async def test_fork_not_share_event_loop(self):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_pty.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from test.support.import_helper import import_module
from test.support.os_helper import TESTFN, unlink

# Skip these tests if termios or fcntl are not available
# Skip these tests if termios is not available
import_module('termios')

# Skip tests on WASM platforms, plus iOS/tvOS/watchOS
Expand Down
8 changes: 4 additions & 4 deletions Lib/test/test_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
or sys._base_executable != sys.executable,
'cannot run venv.create from within a venv on this platform')

if is_emscripten or is_wasi:
raise unittest.SkipTest("venv is not available on Emscripten/WASI.")
if is_apple_mobile:
raise unittest.SkipTest("venv is not available on mobile Apple platforms.")
# Skip tests on WASM platforms, plus iOS/tvOS/watchOS
if is_apple_mobile or is_emscripten or is_wasi:
raise unittest.SkipTest(f"venv tests not required on {sys.platform}")


@requires_subprocess()
def check_output(cmd, encoding=None):
Expand Down
Loading