Version 2 (modified by jarrod.millman, 6 years ago)

more migration work

Testing Guidelines

SciPy?'s testing structure is based on the unit testing framework offered by unittest.py. scipy_test.py also provides a few helper functions.

Our goal is that every module and package in SciPy? includes a thorough set of unit tests. These tests should exercise the functionality of a routine as well as its robustness to erroneous or unexpected input arguments. The best time to write the tests is when the module itself is being written. Whenever a new bug is found in a routine, a unit test should be written to test for the error so that it can't creep back in unnoticed after future code changes.

Much of SciPy? is legacy code that was written without unit tests. As such, much of the functionality remains untested. However, more unit tests are being written all the time (and we encourage you to contribute). If you are writing a package that you'd like to become part of SciPy?, please write the tests as you develop the package.

Running SciPy?'s test suite

To run tests on the scipy package, use the following:

>>> import scipy
>>> scipy.test()

This runs through the set of tests suite for SciPy?. If you are only interested in testing a subset of SciPy?, for example, the integrate module, use the following:

>>> scipy.integrate.test()
  Found 10 tests for scipy.integrate.quadpack
  Found 3 tests for scipy.integrate.quadrature
  Found 1 tests for scipy.integrate
  Found 0 tests for __main__
..........Took 13 points.
...Residual: 1.05006950608e-07
.
----------------------------------------------------------------------
Ran 14 tests in 0.054s

OK
<unittest.TextTestRunner object at 0xb79061cc>
>>>