Skip to content

Commit 730902c

Browse files
authored
gh-90473: WASI: Mark tests that require os.pipe() (GH-92837)
1 parent 3ed1cae commit 730902c

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

Lib/test/test_atexit.py

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def f():
8282
self.assertEqual(ret, 0)
8383
self.assertEqual(atexit._ncallbacks(), n)
8484

85+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
8586
def test_callback_on_subinterpreter_teardown(self):
8687
# This tests if a callback is called on
8788
# subinterpreter teardown.

Lib/test/test_capi.py

+2
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,7 @@ def test_pendingcalls_non_threaded(self):
788788

789789
class SubinterpreterTest(unittest.TestCase):
790790

791+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
791792
def test_subinterps(self):
792793
import builtins
793794
r, w = os.pipe()
@@ -803,6 +804,7 @@ def test_subinterps(self):
803804
self.assertNotEqual(pickle.load(f), id(sys.modules))
804805
self.assertNotEqual(pickle.load(f), id(builtins))
805806

807+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
806808
def test_subinterps_recent_language_features(self):
807809
r, w = os.pipe()
808810
code = """if 1:

Lib/test/test_io.py

+7
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ def test_invalid_operations(self):
429429
@unittest.skipIf(
430430
support.is_emscripten, "fstat() of a pipe fd is not supported"
431431
)
432+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
432433
def test_optional_abilities(self):
433434
# Test for OSError when optional APIs are not supported
434435
# The purpose of this test is to try fileno(), reading, writing and
@@ -3970,6 +3971,7 @@ def test_removed_u_mode(self):
39703971
@unittest.skipIf(
39713972
support.is_emscripten, "fstat() of a pipe fd is not supported"
39723973
)
3974+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
39733975
def test_open_pipe_with_append(self):
39743976
# bpo-27805: Ignore ESPIPE from lseek() in open().
39753977
r, w = os.pipe()
@@ -4108,6 +4110,7 @@ def cleanup_fds():
41084110
with warnings_helper.check_no_resource_warning(self):
41094111
open(r, *args, closefd=False, **kwargs)
41104112

4113+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
41114114
def test_warn_on_dealloc_fd(self):
41124115
self._check_warn_on_dealloc_fd("rb", buffering=0)
41134116
self._check_warn_on_dealloc_fd("rb")
@@ -4147,6 +4150,7 @@ def test_nonblock_pipe_write_smallbuf(self):
41474150

41484151
@unittest.skipUnless(hasattr(os, 'set_blocking'),
41494152
'os.set_blocking() required for this test')
4153+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
41504154
def _test_nonblock_pipe_write(self, bufsize):
41514155
sent = []
41524156
received = []
@@ -4458,14 +4462,17 @@ def _read():
44584462
raise
44594463

44604464
@requires_alarm
4465+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
44614466
def test_interrupted_write_unbuffered(self):
44624467
self.check_interrupted_write(b"xy", b"xy", mode="wb", buffering=0)
44634468

44644469
@requires_alarm
4470+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
44654471
def test_interrupted_write_buffered(self):
44664472
self.check_interrupted_write(b"xy", b"xy", mode="wb")
44674473

44684474
@requires_alarm
4475+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
44694476
def test_interrupted_write_text(self):
44704477
self.check_interrupted_write("xy", b"xy", mode="w", encoding="ascii")
44714478

Lib/test/test_signal.py

+4
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def test_invalid_socket(self):
222222
# Emscripten does not support fstat on pipes yet.
223223
# https://github.com/emscripten-core/emscripten/issues/16414
224224
@unittest.skipIf(support.is_emscripten, "Emscripten cannot fstat pipes.")
225+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
225226
def test_set_wakeup_fd_result(self):
226227
r1, w1 = os.pipe()
227228
self.addCleanup(os.close, r1)
@@ -260,6 +261,7 @@ def test_set_wakeup_fd_socket_result(self):
260261
# function to test if a socket is in non-blocking mode.
261262
@unittest.skipIf(sys.platform == "win32", "tests specific to POSIX")
262263
@unittest.skipIf(support.is_emscripten, "Emscripten cannot fstat pipes.")
264+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
263265
def test_set_wakeup_fd_blocking(self):
264266
rfd, wfd = os.pipe()
265267
self.addCleanup(os.close, rfd)
@@ -320,6 +322,7 @@ def check_signum(signals):
320322
assert_python_ok('-c', code)
321323

322324
@unittest.skipIf(_testcapi is None, 'need _testcapi')
325+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
323326
def test_wakeup_write_error(self):
324327
# Issue #16105: write() errors in the C signal handler should not
325328
# pass silently.
@@ -659,6 +662,7 @@ def handler(signum, frame):
659662
@unittest.skipIf(sys.platform == "win32", "Not valid on Windows")
660663
@unittest.skipUnless(hasattr(signal, 'siginterrupt'), "needs signal.siginterrupt()")
661664
@support.requires_subprocess()
665+
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
662666
class SiginterruptTest(unittest.TestCase):
663667

664668
def readpipe_interrupted(self, interrupt):

0 commit comments

Comments
 (0)