]> granicus.if.org Git - python/commitdiff
bpo-33532: Fix multiprocessing test_ignore() (GH-7262)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 31 May 2018 03:28:04 +0000 (20:28 -0700)
committerGitHub <noreply@github.com>
Thu, 31 May 2018 03:28:04 +0000 (20:28 -0700)
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 5d6c7ed5e340b2311a15f34e968d4bef09c71922)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
Lib/test/_test_multiprocessing.py

index aa8eb7564130ae9596e13df6bb7e75acf03d188f..f29dda70029bc24014513ca67ac880760d92dd7d 100644 (file)
@@ -4303,7 +4303,7 @@ class TestIgnoreEINTR(unittest.TestCase):
         conn.send('ready')
         x = conn.recv()
         conn.send(x)
-        conn.send_bytes(b'x' * (1024 * 1024))   # sending 1 MiB should block
+        conn.send_bytes(b'x' * support.PIPE_MAX_SIZE)
 
     @unittest.skipUnless(hasattr(signal, 'SIGUSR1'), 'requires SIGUSR1')
     def test_ignore(self):
@@ -4322,7 +4322,7 @@ class TestIgnoreEINTR(unittest.TestCase):
             self.assertEqual(conn.recv(), 1234)
             time.sleep(0.1)
             os.kill(p.pid, signal.SIGUSR1)
-            self.assertEqual(conn.recv_bytes(), b'x'*(1024*1024))
+            self.assertEqual(conn.recv_bytes(), b'x' * support.PIPE_MAX_SIZE)
             time.sleep(0.1)
             p.join()
         finally: