summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-28 18:39:51 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-28 18:39:51 (GMT)
commit1770fde94cb2bbcd05f4e3e72e2b78074566f522 (patch)
tree310c03e2b8096fff4c9fbdd8db9ff3ae7ba9b63b /Lib/test/test_io.py
parentcb0c60258b9c11b7742b6e1e6d65e33a6c9a3332 (diff)
parent9db55004a1bc0c0b3efca69dcd577ff58a86ea16 (diff)
downloadcpython-1770fde94cb2bbcd05f4e3e72e2b78074566f522.zip
cpython-1770fde94cb2bbcd05f4e3e72e2b78074566f522.tar.gz
cpython-1770fde94cb2bbcd05f4e3e72e2b78074566f522.tar.bz2
Make some tests more frienly to MemoryError.
Free memory, unlock hanging threads.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 6a41ae6..8754779 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -3603,11 +3603,16 @@ class SignalsTest(unittest.TestCase):
# received (forcing a first EINTR in write()).
read_results = []
write_finished = False
+ error = None
def _read():
- while not write_finished:
- while r in select.select([r], [], [], 1.0)[0]:
- s = os.read(r, 1024)
- read_results.append(s)
+ try:
+ while not write_finished:
+ while r in select.select([r], [], [], 1.0)[0]:
+ s = os.read(r, 1024)
+ read_results.append(s)
+ except BaseException as exc:
+ nonlocal error
+ error = exc
t = threading.Thread(target=_read)
t.daemon = True
def alarm1(sig, frame):
@@ -3633,6 +3638,7 @@ class SignalsTest(unittest.TestCase):
write_finished = True
t.join()
+ self.assertIsNone(error)
self.assertEqual(N, sum(len(x) for x in read_results))
finally:
write_finished = True