Fixed in 150fa296f5b9.
New version uses binary stream for output.
assertStderrEqual cannot be applied because it strips newlines which
are subject for check.
On Thu, Aug 16, 2012 at 1:25 AM, Antoine Pitrou wrote:
> On Wed, 15 Aug 2012 21:54:06 +0200 (CEST)
> andrew.svetlov wrote:
>>
>> diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
>> --- a/Lib/test/test_subprocess.py
>> +++ b/Lib/test/test_subprocess.py
>> @@ -645,6 +645,34 @@
>> p.communicate()
>> self.assertEqual(p.returncode, 0)
>>
>> +def test_universal_newlines_communicate_stdin_stdout_stderr(self):
>> +# universal newlines through communicate(), with only stdin
>> +p = subprocess.Popen([sys.executable, "-c",
>> + 'import sys,os;' + SETBINARY + '''\nif True:
>> + s = sys.stdin.readline()
>> + sys.stdout.write(s)
>> + sys.stdout.write("line2\\r")
>> + sys.stderr.write("eline2\\n")
>> + s = sys.stdin.read()
>> + sys.stdout.write(s+"line4\\n")
>> + sys.stdout.write(s+"line5\\r\\n")
>> + sys.stderr.write("eline6\\n")
>> + sys.stderr.write("eline7\\r")
>> + sys.stderr.write("eline8\\r\\n")
>> + '''],
>
> This test is wrong. You need to write your test data as binary data on
> the binary output streams, as in the other tests. Using the text
> output streams introduces a spurious line ending conversion, which makes
> the test fail under Windows:
> http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/486
>
>> +# Python debug build push something like "[42442 refs]\n"
>> +# to stderr at exit of subprocess.
>> +
>> self.assertTrue(stderr.startswith("eline2\neline6\neline7\neline8\n"))
>
> You should use self.assertStderrEqual() instead.
>
> Regards
>
> Antoine.
>
>
> --
> Software development and contracting: http://pro.pitrou.net
>
>
> ___
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/andrew.svetlov%40gmail.com
--
Thanks,
Andrew Svetlov
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com