Commit f6cf7deb authored by Jason Madden's avatar Jason Madden

I verified in a local VM that gevent's universal newline handling in...

I verified in a local VM that gevent's universal newline handling in subprocess matches the stdlibs (it's arguably broken). Update the tests for this case and mark them no longer failing
parent a9e71b54
......@@ -8,9 +8,8 @@
==================
- Windows/Python 3: Port the :mod:`gevent.subprocess` module, fixing a
large number of failing tests. Universal newline support, however,
still has some edge cases. Examples of failures are in :issue:`668`
and :issue:`669` srossross.
large number of failing tests. Examples of failures are in
:issue:`668` and :issue:`669` srossross.
1.1b6 (Oct 17, 2015)
====================
......
......@@ -440,8 +440,13 @@ class Popen(object):
if PY3:
# FileObjectThread doesn't support the 'U' qualifier
# with a bufsize of 0
# XXX: Universal newlines seem broken on windows?
self.stdout = FileObject(c2pread, 'rb', bufsize)
# NOTE: Universal Newlines are broken on Windows/Py3, at least
# in some cases. This is true in the stdlib subprocess module
# as well; the following line would fix the test cases in
# test__subprocess.py that depend on python_universal_newlines,
# but would be inconsistent with the stdlib:
#msvcrt.setmode(self.stdout.fileno(), os.O_TEXT)
self.stdout.io = io.TextIOWrapper(self.stdout.io)
self.stdout.io.mode = 'r'
self.stdout._translate = True
......
......@@ -20,6 +20,13 @@ else:
python_universal_newlines = hasattr(sys.stdout, 'newlines')
# The stdlib of Python 3 on Windows doesn't properly handle universal newlines
# (it produces broken results compared to Python 2)
# See gevent.subprocess for more details.
if PY3 and subprocess.mswindows:
python_universal_newlines_broken = True
else:
python_universal_newlines_broken = False
class Test(greentest.TestCase):
......@@ -93,8 +100,13 @@ class Test(greentest.TestCase):
stdout = p.stdout.read()
if python_universal_newlines:
# Interpreter with universal newline support
self.assertEqual(stdout,
"line1\nline2\nline3\nline4\nline5\nline6")
if not python_universal_newlines_broken:
self.assertEqual(stdout,
"line1\nline2\nline3\nline4\nline5\nline6")
else:
# Note the extra newline after line 3
self.assertEqual(stdout,
'line1\nline2\nline3\n\nline4\n\nline5\nline6')
else:
# Interpreter without universal newline support
self.assertEqual(stdout,
......@@ -121,8 +133,13 @@ class Test(greentest.TestCase):
stdout = p.stdout.read()
if python_universal_newlines:
# Interpreter with universal newline support
self.assertEqual(stdout,
"line1\nline2\nline3\nline4\nline5\nline6")
if not python_universal_newlines_broken:
self.assertEqual(stdout,
"line1\nline2\nline3\nline4\nline5\nline6")
else:
# Note the extra newline after line 3
self.assertEqual(stdout,
'line1\nline2\nline3\n\nline4\n\nline5\nline6')
else:
# Interpreter without universal newline support
self.assertEqual(stdout,
......
......@@ -92,7 +92,6 @@ if sys.platform == 'win32':
if PY3:
# XXX need investigating
FAILING_TESTS += [
'test__subprocess.py', # universal newlines are borked?
'FLAKY test__api_timeout.py',
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment