bpo-33532: Fix multiprocessing test_ignore() (GH-7262) (#7266)

Fix test_ignore() of multiprocessing tests like
test_multiprocessing_forkserver: use support.PIPE_MAX_SIZE to make
sure that send_bytes() blocks.

(cherry picked from commit 5d6c7ed5e3)
This commit is contained in:
Victor Stinner 2018-05-31 07:35:03 +02:00 committed by GitHub
parent 7da7a01f99
commit c2870b699e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -4029,7 +4029,7 @@ class TestIgnoreEINTR(unittest.TestCase):
conn.send('ready') conn.send('ready')
x = conn.recv() x = conn.recv()
conn.send(x) conn.send(x)
conn.send_bytes(b'x'*(1024*1024)) # sending 1 MB should block conn.send_bytes(b'x' * test.support.PIPE_MAX_SIZE)
@unittest.skipUnless(hasattr(signal, 'SIGUSR1'), 'requires SIGUSR1') @unittest.skipUnless(hasattr(signal, 'SIGUSR1'), 'requires SIGUSR1')
def test_ignore(self): def test_ignore(self):
@ -4048,7 +4048,8 @@ class TestIgnoreEINTR(unittest.TestCase):
self.assertEqual(conn.recv(), 1234) self.assertEqual(conn.recv(), 1234)
time.sleep(0.1) time.sleep(0.1)
os.kill(p.pid, signal.SIGUSR1) os.kill(p.pid, signal.SIGUSR1)
self.assertEqual(conn.recv_bytes(), b'x'*(1024*1024)) self.assertEqual(conn.recv_bytes(),
b'x' * test.support.PIPE_MAX_SIZE)
time.sleep(0.1) time.sleep(0.1)
p.join() p.join()
finally: finally: