Commit c2c20287 authored by Fantix King's avatar Fantix King Committed by Denis Bilenko

Fixed subprocess tests.

parent 77345daa
...@@ -64,12 +64,12 @@ class Test(greentest.TestCase): ...@@ -64,12 +64,12 @@ class Test(greentest.TestCase):
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate("banana") (stdout, stderr) = p.communicate(b"banana")
self.assertEqual(stdout, "banana") self.assertEqual(stdout, b"banana")
if sys.executable.endswith('-dbg'): if sys.executable.endswith('-dbg'):
assert stderr.startswith('pineapple') assert stderr.startswith(b'pineapple')
else: else:
self.assertEqual(stderr, "pineapple") self.assertEqual(stderr, b"pineapple")
def test_universal1(self): def test_universal1(self):
p = subprocess.Popen([sys.executable, "-c", p = subprocess.Popen([sys.executable, "-c",
...@@ -96,7 +96,7 @@ class Test(greentest.TestCase): ...@@ -96,7 +96,7 @@ class Test(greentest.TestCase):
else: else:
# Interpreter without universal newline support # Interpreter without universal newline support
self.assertEqual(stdout, self.assertEqual(stdout,
"line1\nline2\rline3\r\nline4\r\nline5\nline6") b"line1\nline2\rline3\r\nline4\r\nline5\nline6")
finally: finally:
p.stdout.close() p.stdout.close()
...@@ -123,7 +123,7 @@ class Test(greentest.TestCase): ...@@ -123,7 +123,7 @@ class Test(greentest.TestCase):
else: else:
# Interpreter without universal newline support # Interpreter without universal newline support
self.assertEqual(stdout, self.assertEqual(stdout,
"line1\nline2\rline3\r\nline4\r\nline5\nline6") b"line1\nline2\rline3\r\nline4\r\nline5\nline6")
finally: finally:
p.stdout.close() p.stdout.close()
......
...@@ -12,7 +12,7 @@ else: ...@@ -12,7 +12,7 @@ else:
import subprocess import subprocess
for _ in xrange(5): for _ in xrange(5):
out, err = subprocess.Popen([sys.executable, __file__, 'runtestcase'], stderr=subprocess.PIPE).communicate() out, err = subprocess.Popen([sys.executable, __file__, 'runtestcase'], stderr=subprocess.PIPE).communicate()
if 'refs' in err: if b'refs' in err:
assert err.startswith('bye'), repr(err) assert err.startswith(b'bye'), repr(err)
else: else:
assert err.strip() == 'bye', repr(err) assert err.strip() == b'bye', repr(err)
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