module documentation

Nose test running.

This module implements test() and bench() functions for NumPy modules.

Class ​Nose​Tester Nose test runner.
Function ​_numpy​_tester Undocumented
Function get​_package​_name Given a path where a package is installed, determine its name.
Function import​_nose Import nose only when needed.
Function run​_module​_suite Run a test module.
def _numpy_tester():

Undocumented

def get_package_name(filepath):

Given a path where a package is installed, determine its name.

Parameters

filepath : str
Path to a file. If the determination fails, "numpy" is returned.

Examples

>>> np.testing.nosetester.get_package_name('nonsense')
'numpy'
def import_nose():
Import nose only when needed.
def run_module_suite(file_to_run=None, argv=None):

Run a test module.

Equivalent to calling $ nosetests <argv> <file_to_run> from the command line

Parameters

file_to_run : str, optional
Path to test module, or None. By default, run the module from which this function is called.
argv : list of strings

Arguments to be passed to the nose test runner. argv[0] is ignored. All command line arguments accepted by nosetests will work. If it is the default value None, sys.argv is used.

New in version 1.9.0.

Examples

Adding the following:

if __name__ == "__main__" :
    run_module_suite(argv=sys.argv)

at the end of a test module will run the tests when that module is called in the python interpreter.

Alternatively, calling:

>>> run_module_suite(file_to_run="numpy/tests/test_matlib.py")  # doctest: +SKIP

from an interpreter will run all the test routine in 'test_matlib.py'.