This script automatically installs during the setup procedure with the name $ obspy-runtests. For more info on the command line options, please run $ obspy-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 the each specific module. The __init__.py of the tests directory itself as well as every test file located in the tests directory has a function called suite, which is executed using this script. Running the script with the verbose keyword exposes the names of all available test cases.

copyright:The ObsPy Development Team (devs@obspy.org)
license:GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)


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

    $ obspy-runtests

    or via Python interpreter

    >>> import obspy.core
    >>> obspy.core.run_tests()  # DOCTEST: +SKIP
  2. Run all tests on command line:

    $ obspy-runtests --all

    or via Python interpreter

    >>> import obspy.core
    >>> obspy.core.run_tests(all=True)  # DOCTEST: +SKIP
  3. Verbose output:

    $ obspy-runtests -v


    >>> import obspy.core
    >>> obspy.core.run_tests(verbosity=2)  # DOCTEST: +SKIP
  4. Run tests of module obspy.io.mseed:

    $ obspy-runtests obspy.io.mseed.tests.suite

    or as shortcut:

    $ obspy-runtests io.mseed
  5. Run tests of multiple modules, e.g. obspy.io.wav and obspy.io.sac:

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

    $ obspy-runtests obspy.core.tests.test_stats.StatsTestCase.test_init


    >>> import obspy.core
    >>> tests = ['obspy.core.tests.test_stats.StatsTestCase.test_init']
    >>> obspy.core.run_tests(verbosity=2, tests=tests)  # DOCTEST: +SKIP
  7. Report test results to https://tests.obspy.org/:

    $ obspy-runtests -r
  8. To get a full list of all options, use:

    $ obspy-runtests --help

Of course you may combine most of the options here, e.g. in order to test all modules except the module obspy.io.sh and obspy.clients.seishub, have a verbose output and report everything, you would run:

$ obspy-runtests -r -v -x clients.seishub -x io.sh --all