Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Run each IPython test group in its own process.

  • Loading branch information...
commit 86a8e1a2ad376b8c223581589ca43d522c27a42b 1 parent 93a106f
@bfroehle authored
Showing with 21 additions and 7 deletions.
  1. +21 −7 IPython/testing/iptest.py
View
28 IPython/testing/iptest.py
@@ -27,6 +27,7 @@
# Stdlib
import glob
+import multiprocessing
import os
import os.path as path
import signal
@@ -370,12 +371,15 @@ def run(self):
env = os.environ.copy()
env['IPYTHONDIR'] = IPYTHONDIR
# print >> sys.stderr, '*** CMD:', ' '.join(self.call_args) # dbg
- subp = subprocess.Popen(self.call_args, env=env)
+ subp = subprocess.Popen(self.call_args, env=env,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
self.pids.append(subp.pid)
# If this fails, the pid will be left in self.pids and cleaned up
# later, but if the wait call succeeds, then we can clear the
# stored pid.
- retcode = subp.wait()
+ out = subp.communicate()[0]
+ retcode = subp.returncode
self.pids.pop()
except:
import traceback
@@ -384,7 +388,7 @@ def run(self):
if self.coverage_xml:
subprocess.call(["coverage", "xml", "-o", self.coverage_xml])
- return retcode
+ return retcode, out
def __del__(self):
"""Cleanup on exit by killing any leftover processes."""
@@ -473,6 +477,14 @@ def run_iptest():
# Now nose can run
TestProgram(argv=argv, addplugins=plugins)
+def _run_test(args):
+ """Run a test group."""
+ name, runner = args
+ res, out = runner.run()
+ print '*'*70
+ print 'IPython test group:', name
+ print out
+ return res
def run_iptestall():
"""Run the entire IPython test suite by calling nose and trial.
@@ -496,11 +508,13 @@ def run_iptestall():
# Run all test runners, tracking execution time
failed = []
t_start = time.time()
+ print '*'*70
+ print "Running tests; results will be displayed as each test group finishes."
+
+ p = multiprocessing.Pool()
try:
- for (name, runner) in runners:
- print '*'*70
- print 'IPython test group:',name
- res = runner.run()
+ res = p.map(_run_test, runners)
+ for (name, runner), res in zip(runners, res):
if res:
failed.append( (name, runner) )
finally:
Please sign in to comment.
Something went wrong with that request. Please try again.