diff options
author | Pascal Bugnion <pob24@cam.ac.uk> | 2014-01-15 10:59:27 +0000 |
---|---|---|
committer | Pascal Bugnion <pob24@cam.ac.uk> | 2014-01-15 11:10:04 +0000 |
commit | 893fe99b7957198adf8b74109d334266fdc31006 (patch) | |
tree | 1c5c910ca44d76422093a4340650f693a7e6e2fd /numpy/testing/nosetester.py | |
parent | e7f4ad04c12986f1b94759cbd0a6a27d2124f107 (diff) | |
download | numpy-893fe99b7957198adf8b74109d334266fdc31006.tar.gz |
DOC: Added docstring for run_module_suite.
Diffstat (limited to 'numpy/testing/nosetester.py')
-rw-r--r-- | numpy/testing/nosetester.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py index 6256a24f1..dd27862d6 100644 --- a/numpy/testing/nosetester.py +++ b/numpy/testing/nosetester.py @@ -76,6 +76,38 @@ def import_nose(): return nose 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. + + 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") + + from an interpreter will run all the test routine in 'test_matlib.py'. + """ if file_to_run is None: f = sys._getframe(1) file_to_run = f.f_locals.get('__file__', None) |