Warning
This documentation is for an old version of IPython. You can find docs for newer versions here.
Generic testing tools.
Bases: object
Utility class to create temporary Python/IPython files.
Meant as a mixin class for test cases.
Make a valid python temp file.
Bases: _io.StringIO
Bases: object
Context manager for testing that code prints certain text.
Examples
>>> with AssertPrints("abc", suppress=False):
...     print "abcd"
...     print "def"
... 
abcd
def
Bases: IPython.testing.tools.AssertPrints
Context manager for checking that certain output isn’t produced.
Counterpart of AssertPrints
Make full paths for all the listed files, based on startPath.
Only the base part of startPath is kept, since this routine is typically used with a script’s __file__ variable as startPath. The base of startPath is then prepended to all the listed files, forming the output list.
| Parameters: | startPath : string 
  | 
|---|
Examples
>>> full_path('/foo/bar.py',['a.txt','b.txt'])
['/foo/a.txt', '/foo/b.txt']
>>> full_path('/foo',['a.txt','b.txt'])
['/a.txt', '/b.txt']
If a single file is given, the output is still a list: >>> full_path(‘/foo’,’a.txt’) [‘/a.txt’]
Parse the output of a test run and return errors, failures.
| Parameters: | txt : str 
  | 
|---|---|
| Returns: | nerr, nfail: number of errors and failures. :  | 
Return a valid default argv for creating testing instances of ipython
Return a config object with good defaults for testing.
Return appropriate IPython command line name. By default, this will return a list that can be used with subprocess.Popen, for example, but passing as_string=True allows for returning the IPython command as a string.
| Parameters: | as_string: bool : 
  | 
|---|
Utility to call ‘ipython filename’.
Starts IPython with a minimal and safe configuration to make startup as fast as possible.
Note that this starts IPython in a subprocess!
| Parameters: | fname : str 
 options : optional, list 
  | 
|---|---|
| Returns: | (stdout, stderr) of ipython subprocess. :  | 
Utility to call ‘ipython filename’ and validate output/error.
This function raises an AssertionError if the validation fails.
Note that this starts IPython in a subprocess!
| Parameters: | fname : str 
 expected_out : str 
 expected_err : optional, str 
 options : optional, list 
  | 
|---|---|
| Returns: | None :  | 
Utility function for the common case of checking a function with a sequence of input/output pairs.
| Parameters: | func : callable 
 pairs : iterable 
  | 
|---|---|
| Returns: | None. Raises an AssertionError if any output does not match the expected : value. :  | 
Create an empty, named, temporary file for the duration of the context.
Context manager to replace attribute named name in obj with attr.
test that ipython [subcommand] -h works
test that ipython [subcommand] –help-all works