summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-02-05 19:52:01 (GMT)
committerGitHub <noreply@github.com>2022-02-05 19:52:01 (GMT)
commit96b344c2f15cb09251018f57f19643fe20637392 (patch)
tree3fe6c8f5d1a2897881806db1f3b441d11114adeb /Lib/test/test_io.py
parent9d4161a60ca8b470148ffd6c73e3110a0aa6d66f (diff)
downloadcpython-96b344c2f15cb09251018f57f19643fe20637392.zip
cpython-96b344c2f15cb09251018f57f19643fe20637392.tar.gz
cpython-96b344c2f15cb09251018f57f19643fe20637392.tar.bz2
bpo-40280: Address more test failures on Emscripten (GH-31050)
Co-authored-by: Brett Cannon <brett@python.org>
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index a10611a..e9abd15 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -76,6 +76,10 @@ def _default_chunk_size():
with open(__file__, "r", encoding="latin-1") as f:
return f._CHUNK_SIZE
+requires_alarm = unittest.skipUnless(
+ hasattr(signal, "alarm"), "test requires signal.alarm()"
+)
+
class MockRawIOWithoutRead:
"""A RawIO implementation without read(), so as to exercise the default
@@ -4435,12 +4439,15 @@ class SignalsTest(unittest.TestCase):
if e.errno != errno.EBADF:
raise
+ @requires_alarm
def test_interrupted_write_unbuffered(self):
self.check_interrupted_write(b"xy", b"xy", mode="wb", buffering=0)
+ @requires_alarm
def test_interrupted_write_buffered(self):
self.check_interrupted_write(b"xy", b"xy", mode="wb")
+ @requires_alarm
def test_interrupted_write_text(self):
self.check_interrupted_write("xy", b"xy", mode="w", encoding="ascii")
@@ -4472,9 +4479,11 @@ class SignalsTest(unittest.TestCase):
wio.close()
os.close(r)
+ @requires_alarm
def test_reentrant_write_buffered(self):
self.check_reentrant_write(b"xy", mode="wb")
+ @requires_alarm
def test_reentrant_write_text(self):
self.check_reentrant_write("xy", mode="w", encoding="ascii")
@@ -4502,10 +4511,12 @@ class SignalsTest(unittest.TestCase):
os.close(w)
os.close(r)
+ @requires_alarm
def test_interrupted_read_retry_buffered(self):
self.check_interrupted_read_retry(lambda x: x.decode('latin1'),
mode="rb")
+ @requires_alarm
def test_interrupted_read_retry_text(self):
self.check_interrupted_read_retry(lambda x: x,
mode="r", encoding="latin1")
@@ -4578,9 +4589,11 @@ class SignalsTest(unittest.TestCase):
if e.errno != errno.EBADF:
raise
+ @requires_alarm
def test_interrupted_write_retry_buffered(self):
self.check_interrupted_write_retry(b"x", mode="wb")
+ @requires_alarm
def test_interrupted_write_retry_text(self):
self.check_interrupted_write_retry("x", mode="w", encoding="latin1")