diff Lib/test/test_subprocess.py @ 78571:839bd8f98539 3.2

Add test to explicit check the absence regression in subprocess (issue #15592). Patch by Chris Jerdonek.
author Andrew Svetlov <andrew.svetlov@gmail.com>
date Tue, 14 Aug 2012 18:35:17 +0300
parents 481f5d9ef577
children a0f7c2f79bce 9d86480cc177
line wrap: on
line diff
--- a/Lib/test/test_subprocess.py	Tue Aug 14 15:38:15 2012 +0300
+++ b/Lib/test/test_subprocess.py	Tue Aug 14 18:35:17 2012 +0300
@@ -548,6 +548,18 @@
         (stdout, stderr) = p.communicate("line1\nline3\n")
         self.assertEqual(p.returncode, 0)
 
+    def test_universal_newlines_communicate_input_none(self):
+        # Test communicate(input=None) with universal newlines.
+        #
+        # We set stdout to PIPE because, as of this writing, a different
+        # code path is tested when the number of pipes is zero or one.
+        p = subprocess.Popen([sys.executable, "-c", "pass"],
+                             stdin=subprocess.PIPE,
+                             stdout=subprocess.PIPE,
+                             universal_newlines=True)
+        p.communicate()
+        self.assertEqual(p.returncode, 0)
+
     def test_no_leaking(self):
         # Make sure we leak no resources
         if not mswindows: