[Python-checkins] gh-90473: WASI: Mark tests that require os.pipe() (GH-92837)
miss-islington
webhook-mailer at python.org
Mon May 16 04:04:05 EDT 2022
https://github.com/python/cpython/commit/5f24acdca0e2777afec90aac5e63936ec571099b
commit: 5f24acdca0e2777afec90aac5e63936ec571099b
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-05-16T01:04:01-07:00
summary:
gh-90473: WASI: Mark tests that require os.pipe() (GH-92837)
(cherry picked from commit 730902c0ad997462d2567e48def5352fe75c0e2c)
Co-authored-by: Christian Heimes <christian at python.org>
files:
M Lib/test/test_atexit.py
M Lib/test/test_capi.py
M Lib/test/test_io.py
M Lib/test/test_signal.py
diff --git a/Lib/test/test_atexit.py b/Lib/test/test_atexit.py
index e0feef7c65360..7ac063cfc78d3 100644
--- a/Lib/test/test_atexit.py
+++ b/Lib/test/test_atexit.py
@@ -82,6 +82,7 @@ def f():
self.assertEqual(ret, 0)
self.assertEqual(atexit._ncallbacks(), n)
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_callback_on_subinterpreter_teardown(self):
# This tests if a callback is called on
# subinterpreter teardown.
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 6d75895589328..904ae9bc47ecf 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -788,6 +788,7 @@ def test_pendingcalls_non_threaded(self):
class SubinterpreterTest(unittest.TestCase):
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_subinterps(self):
import builtins
r, w = os.pipe()
@@ -803,6 +804,7 @@ def test_subinterps(self):
self.assertNotEqual(pickle.load(f), id(sys.modules))
self.assertNotEqual(pickle.load(f), id(builtins))
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_subinterps_recent_language_features(self):
r, w = os.pipe()
code = """if 1:
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 5528c461e58ae..039da535d488a 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -429,6 +429,7 @@ def test_invalid_operations(self):
@unittest.skipIf(
support.is_emscripten, "fstat() of a pipe fd is not supported"
)
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_optional_abilities(self):
# Test for OSError when optional APIs are not supported
# The purpose of this test is to try fileno(), reading, writing and
@@ -3970,6 +3971,7 @@ def test_removed_u_mode(self):
@unittest.skipIf(
support.is_emscripten, "fstat() of a pipe fd is not supported"
)
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_open_pipe_with_append(self):
# bpo-27805: Ignore ESPIPE from lseek() in open().
r, w = os.pipe()
@@ -4108,6 +4110,7 @@ def cleanup_fds():
with warnings_helper.check_no_resource_warning(self):
open(r, *args, closefd=False, **kwargs)
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_warn_on_dealloc_fd(self):
self._check_warn_on_dealloc_fd("rb", buffering=0)
self._check_warn_on_dealloc_fd("rb")
@@ -4147,6 +4150,7 @@ def test_nonblock_pipe_write_smallbuf(self):
@unittest.skipUnless(hasattr(os, 'set_blocking'),
'os.set_blocking() required for this test')
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def _test_nonblock_pipe_write(self, bufsize):
sent = []
received = []
@@ -4458,14 +4462,17 @@ def _read():
raise
@requires_alarm
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_interrupted_write_unbuffered(self):
self.check_interrupted_write(b"xy", b"xy", mode="wb", buffering=0)
@requires_alarm
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_interrupted_write_buffered(self):
self.check_interrupted_write(b"xy", b"xy", mode="wb")
@requires_alarm
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_interrupted_write_text(self):
self.check_interrupted_write("xy", b"xy", mode="w", encoding="ascii")
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 2ba29fc837d44..6d3b299b24cca 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -222,6 +222,7 @@ def test_invalid_socket(self):
# Emscripten does not support fstat on pipes yet.
# https://github.com/emscripten-core/emscripten/issues/16414
@unittest.skipIf(support.is_emscripten, "Emscripten cannot fstat pipes.")
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_set_wakeup_fd_result(self):
r1, w1 = os.pipe()
self.addCleanup(os.close, r1)
@@ -260,6 +261,7 @@ def test_set_wakeup_fd_socket_result(self):
# function to test if a socket is in non-blocking mode.
@unittest.skipIf(sys.platform == "win32", "tests specific to POSIX")
@unittest.skipIf(support.is_emscripten, "Emscripten cannot fstat pipes.")
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_set_wakeup_fd_blocking(self):
rfd, wfd = os.pipe()
self.addCleanup(os.close, rfd)
@@ -320,6 +322,7 @@ def check_signum(signals):
assert_python_ok('-c', code)
@unittest.skipIf(_testcapi is None, 'need _testcapi')
+ @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_wakeup_write_error(self):
# Issue #16105: write() errors in the C signal handler should not
# pass silently.
@@ -659,6 +662,7 @@ def handler(signum, frame):
@unittest.skipIf(sys.platform == "win32", "Not valid on Windows")
@unittest.skipUnless(hasattr(signal, 'siginterrupt'), "needs signal.siginterrupt()")
@support.requires_subprocess()
+ at unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
class SiginterruptTest(unittest.TestCase):
def readpipe_interrupted(self, interrupt):
More information about the Python-checkins
mailing list