testing.tools

Module: testing.tools

Generic testing tools that do NOT depend on Twisted.

In particular, this module exposes a set of top-level assert* functions that can be used in place of nose.tools.assert* in method generators (the ones in nose can not, at least as of nose 0.10.4).

Note: our testing package contains testing.util, which does depend on Twisted and provides utilities for tests that manage Deferreds. All testing support tools that only depend on nose, IPython or the standard library should go here instead.

Authors

Functions

IPython.testing.tools.full_path(startPath, files)

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

Initial path to use as the base for the results. This path is split

using os.path.split() and only its first component is kept.

files : string or list

One or more files.

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