[pypy-svn] pypy default: Fix for FAIL: test_run_module_bug1764407 (test.test_cmd_line.CmdLineTest)

vincentlegoll commits-noreply at bitbucket.org
Tue Feb 15 20:55:26 CET 2011


Author: Vincent Legoll <vincent.legoll at gmail.com>
Branch: 
Changeset: r42001:fd3b18620932
Date: 2011-02-15 19:47 +0100
http://bitbucket.org/pypy/pypy/changeset/fd3b18620932/

Log:	Fix for FAIL: test_run_module_bug1764407
	(test.test_cmd_line.CmdLineTest)

	The test tries to run "pypy -i" and send input to its stdin via a
	pipe, which upsets pyrepl because it is not a tty-like file.

	Fix by only using pyrepl in interactive_console() if stdin is a tty.

	Signed-off-by: Vincent Legoll <vincent.legoll at gmail.com>

diff --git a/lib_pypy/_pypy_interact.py b/lib_pypy/_pypy_interact.py
--- a/lib_pypy/_pypy_interact.py
+++ b/lib_pypy/_pypy_interact.py
@@ -24,6 +24,11 @@
         pass
     #
     try:
+        if not os.isatty(sys.stdin.fileno()):
+            # Bail out if stdin is not tty-like, as pyrepl wouldn't be happy
+            # For example, with:
+            # subprocess.Popen(['pypy', '-i'], stdin=subprocess.PIPE)
+            raise ImportError
         from pyrepl.simple_interact import check
         if not check():
             raise ImportError


More information about the Pypy-commit mailing list