Warning

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

Module: testing.iptest

IPython Test Suite Runner.

This module provides a main entry point to a user script to test IPython itself from the command line. There are two ways of running this script:

  1. With the syntax iptest all. This runs our entire test suite by calling this script (with different arguments) recursively. This causes modules and package to be tested in different processes, using nose or trial where appropriate.
  2. With the regular nose syntax, like iptest -vvs IPython. In this form the script simply calls nose, but with special command line flags and plugins loaded.

4 Classes

class IPython.testing.iptest.TestSection(name, includes)

Bases: object

__init__(name, includes)
class IPython.testing.iptest.ExclusionPlugin(exclude_patterns=None)

Bases: nose.plugins.base.Plugin

A nose plugin to effect our exclusions of files and directories.

__init__(exclude_patterns=None)
Parameters:

exclude_patterns : sequence of strings, optional

Filenames containing these patterns (as raw strings, not as regular expressions) are excluded from the tests.

wantDirectory(directory)

Return whether the given directory should be scanned for tests.

wantFile(filename)

Return whether the given filename should be scanned for tests.

class IPython.testing.iptest.StreamCapturer(echo=False)

Bases: threading.Thread

__init__(echo=False)
halt()

Safely stop the thread.

class IPython.testing.iptest.SubprocessStreamCapturePlugin

Bases: nose.plugins.base.Plugin

__init__()

5 Functions

IPython.testing.iptest.monkeypatch_xunit()
IPython.testing.iptest.extract_version(mod)
IPython.testing.iptest.test_for(item, min_version=None, callback=<function extract_version>)

Test to see if item is importable, and optionally check against a minimum version.

If min_version is given, the default behavior is to check against the __version__ attribute of the item, but specifying callback allows you to extract the value you are interested in. e.g:

In [1]: import sys

In [2]: from IPython.testing.iptest import test_for

In [3]: test_for('sys', (2,6), callback=lambda sys: sys.version_info)
Out[3]: True
IPython.testing.iptest.check_exclusions_exist()
IPython.testing.iptest.run_iptest()

Run the IPython test suite using nose.

This function is called when this script is not called with the form iptest all. It simply calls nose with appropriate command line flags and accepts all of the standard nose arguments.