Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r89551:5614377fb5fc
Date: 2017-01-13 18:42 +0100
http://bitbucket.org/pypy/pypy/changeset/5614377fb5fc/

Log:    Really fix the test. Skip it in case there is a pypy-only mixture of
        stdout and stderr

diff --git a/lib-python/3/test/test_cmd_line_script.py 
b/lib-python/3/test/test_cmd_line_script.py
--- a/lib-python/3/test/test_cmd_line_script.py
+++ b/lib-python/3/test/test_cmd_line_script.py
@@ -188,11 +188,21 @@
             stderr = p.stdout
         try:
             # Drain stderr until prompt
-            while True:
-                data = stderr.read(len(sys.ps1))
-                if data == sys.ps1.encode('utf-8'):
-                    break
-                stderr.readline()
+            if support.check_impl_detail(pypy=True):
+                ps1 = b">>>> "
+                # PyPy: the prompt is still printed to stdout, like it
+                # is in CPython 2.7.  This messes up the logic below
+                # if stdout and stderr are different.  Skip for now.
+                if separate_stderr:
+                    self.skipTest("the prompt is still written to "
+                                  "stdout in pypy")
+            else:
+                ps1 = b">>> "
+            # logic fixed to support the case of lines that are shorter
+            # than len(ps1) characters
+            got = b""
+            while not got.endswith(ps1):
+                got += stderr.read(1)
             yield p
         finally:
             kill_python(p)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to