Important

This documentation covers IPython versions 6.0 and higher. Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7.

If you are looking for an IPython version compatible with Python 2.7, please use the IPython 5.x LTS release and refer to its documentation (LTS is the long term support release).

Module: testing.iptestcontroller

IPython Test Process Controller

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

2 Classes

class IPython.testing.iptestcontroller.TestController

Bases: object

Run tests in a subprocess

__init__()
cleanup()

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

cleanup_process()

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

process = None

subprocess.Popen instance

section = None

str, IPython test suite to be executed.

setUp()

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.

cleanup()

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

6 Functions

IPython.testing.iptestcontroller.prepare_controllers(options)

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.

Returns

  • 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.

IPython.testing.iptestcontroller.report()

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

IPython.testing.iptestcontroller.run_iptestall(options)

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.

Parameters
  • object. (All parameters are passed as attributes of the options) –

  • 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. By default, these tests aren’t run.

  • 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’

IPython.testing.iptestcontroller.default_options()

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

IPython.testing.iptestcontroller.main()