diff --git a/IPython/testing/tools.py b/IPython/testing/tools.py index 5920018..c54db89 100644 --- a/IPython/testing/tools.py +++ b/IPython/testing/tools.py @@ -26,6 +26,7 @@ import tempfile from contextlib import contextmanager from io import StringIO +from subprocess import Popen, PIPE try: # These tools are used by parts of the runtime, so we make the nose @@ -183,21 +184,22 @@ def ipexec(fname, options=None): '--PromptManager.in2_template=""', '--PromptManager.out_template=""' ] - cmdargs = ' '.join(default_argv() + prompt_opts + options) + cmdargs = default_argv() + prompt_opts + options _ip = get_ipython() test_dir = os.path.dirname(__file__) # FIXME: remove workaround for 2.6 support if sys.version_info[:2] > (2,6): - ipython_cmd = pipes.quote(sys.executable) + " -m IPython" + ipython_cmd = [sys.executable, "-m", "IPython"] else: - ipython_cmd = "ipython" + ipython_cmd = ["ipython"] # Absolute path for filename full_fname = os.path.join(test_dir, fname) - full_cmd = '%s %s %s' % (ipython_cmd, cmdargs, full_fname) - #print >> sys.stderr, 'FULL CMD:', full_cmd # dbg - out, err = getoutputerror(full_cmd) + full_cmd = ipython_cmd + cmdargs + [full_fname] + p = Popen(full_cmd, stdout=PIPE, stderr=PIPE) + out, err = p.communicate() + out, err = py3compat.bytes_to_str(out), py3compat.bytes_to_str(err) # `import readline` causes 'ESC[?1034h' to be output sometimes, # so strip that out before doing comparisons if out: