obspy.scripts.runtests

Note

This script automatically installs during the setup procedure with the name $ obspy-obspy.scripts.runtests. For more info on the command line options, please run $ obspy-obspy.scripts.runtests --help. Alternatively you can also execute $ python -m obspy.scripts.runtests.

A command-line program that runs all ObsPy tests.

All tests in ObsPy are located in the tests directory of each specific module.

A few important command line arguments:

–help : Print help message an exit. –no-report, –report : Do not ask and automatically (not) submit report

to ObsPys’ report server.

–cov obspy: Calculate and display test coverage. –network : Only run network tests (requires an internet connection). –all : Run both network and non-network tests. –keep-images : Store all images generated by tests in obspy’s directory.

Also note, the test runner uses pytest under the hood so any pytest command line argument is also accepted.

Examples

  1. Run all local tests (ignoring tests requiring a network connection) on command line:

    $ obspy-runtests
    
  2. Run all tests on command line (including network tests)::

    $ obspy-runtests –all

  3. Run tests of module obspy.io.mseed::

    $ obspy-runtests io/mseed

  4. Run tests of multiple modules, e.g. obspy.io.wav and obspy.io.sac:

    $ obspy-runtests io/wav obspy/io/sac
    
  5. Run a specific test case::

    $ obspy-runtests core/tests/test_stats.py::TestStats::test_init

  6. Run tests and print a coverage report to screen including missed lines:

    $ obspy-runtests –cov obspy –cov-report term-missing

  7. Save the image outputs of the testsuite, called ‘obspy_image_tests’:

    $ obspy-runtests –keep-images

  8. Run the test suite, drop into a pdb debugging session for each failure:

    $ obspy-runtests –pdb

copyright:

The ObsPy Development Team (devs@obspy.org)

license:

GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)