# HG changeset patch # Parent dcd6d41f2c9aaaf9ff280ea99a8474647a7daac1 Remove misconstrued attempt to avoid race condition in test No need to signal anything through stdout now that we are filling the pipe buffer up. diff -r dcd6d41f2c9a Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py Fri Mar 06 23:33:51 2015 +0200 +++ b/Lib/test/test_subprocess.py Fri Mar 06 22:56:08 2015 +0000 @@ -2504,21 +2504,19 @@ def test_broken_pipe_cleanup(self): """Broken pipe error should not prevent wait() (Issue 21619)""" - args = [sys.executable, "-c", - "import sys;" - "sys.stdin.close();" - "sys.stdout.close();"] # Signals that input pipe is closed + args = [sys.executable, "-c", "pass"] proc = subprocess.Popen(args, stdin=subprocess.PIPE, - stdout=subprocess.PIPE, bufsize=support.PIPE_MAX_SIZE*2) - proc.stdout.read() # Make sure subprocess has closed its input + # Prepare to send enough data to overflow any OS pipe buffering and + # guarantee a broken pipe error. Data is held in BufferedWriter + # buffer until closed. proc.stdin.write(b"x" * support.PIPE_MAX_SIZE) self.assertIsNone(proc.returncode) + # EPIPE expected under POSIX; EINVAL under Windows self.assertRaises(OSError, proc.__exit__, None, None, None) self.assertEqual(0, proc.returncode) self.assertTrue(proc.stdin.closed) - self.assertTrue(proc.stdout.closed) def test_main():