This documentation is for an old version of IPython. You can find docs for newer versions here.

Module: testing.iptestcontroller

IPython Test Process Controller

This module runs one or more subprocesses which will actually run the IPython test suite.

4 Classes

class IPython.testing.iptestcontroller.TimeoutExpired(cmd, timeout, output=None, stderr=None)

Bases: subprocess.SubprocessError

This exception is raised when the timeout expires while waiting for a child process.

class IPython.testing.iptestcontroller.TestController

Bases: object

Run tests in a subprocess


Kill process if it’s still alive, and clean up temporary directories


Cleanup on exit by killing any leftover processes.

cmd = None

list, command line arguments to be executed

dirs = None

list, TemporaryDirectory instances to clear up when the process finishes

env = None

dict, extra environment variables to set for the subprocess


Print extra information about this test run.

If we’re running in parallel and showing the concise view, this is only called if the test group fails. Otherwise, it’s called before the test group is started.

The base implementation does nothing, but it can be overridden by subclasses.

process = None

subprocess.Popen instance

section = None

str, IPython test suite to be executed.


Create temporary directories etc.

This is only called when we know the test group will be run. Things created here may be cleaned up by self.cleanup().

stdout = None

str, process stdout+stderr

class IPython.testing.iptestcontroller.PyTestController(section, options)

Bases: IPython.testing.iptestcontroller.TestController

Run Python tests using IPython.testing.iptest

__init__(section, options)

Create new test runner.


Make the non-accessible directory created in setup() accessible again, otherwise deleting the workingdir will fail.

pycmd = None

str, Python command to execute in subprocess

class IPython.testing.iptestcontroller.JSController(section, xunit=True, engine='phantomjs', url=None)

Bases: IPython.testing.iptestcontroller.TestController

Run CasperJS tests

__init__(section, xunit=True, engine='phantomjs', url=None)

Create new test runner.

wait(*pargs, **kwargs)

Wait for the JSController to finish

9 Functions

IPython.testing.iptestcontroller.popen_wait(p, timeout)

Returns two lists of TestController instances, those to run, and those not to run.

IPython.testing.iptestcontroller.do_run(controller, buffer_output=True)

Setup and run a test controller.

If buffer_output is True, no output is displayed, to avoid it appearing interleaved. In this case, the caller is responsible for displaying test output on failure.


controller : TestController

The same controller as passed in, as a convenience for using map() type APIs.

exitcode : int

The exit code of the test subprocess. Non-zero indicates failure.


Return a string with a summary report of test-related variables.


Run the entire IPython test suite by calling nose and trial.

This function constructs IPTester instances for all IPython modules and package and then runs each of them. This causes the modules and packages of IPython to be tested each in their own subprocess using nose.


All parameters are passed as attributes of the options object.

testgroups : list of str

Run only these sections of the test suite. If empty, run all the available sections.

fast : int or None

Run the test suite in parallel, using n simultaneous processes. If None is passed, one process is used per CPU core. Default 1 (i.e. sequential)

inc_slow : bool

Include slow tests, like IPython.parallel. By default, these tests aren’t run.

slimerjs : bool

Use slimerjs if it’s installed instead of phantomjs for casperjs tests.

url : unicode

Address:port to use when running the JS tests.

xunit : bool

Produce Xunit XML output. This is written to multiple foo.xunit.xml files.

coverage : bool or str

Measure code coverage from tests. True will store the raw coverage data, or pass ‘html’ or ‘xml’ to get reports.

extra_args : list

Extra arguments to pass to the test subprocesses, e.g. ‘-v’


Get an argparse Namespace object with the default arguments, to pass to run_iptestall().