obspy.scripts.runtests¶
Note
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) |
Examples
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
Run all tests on command line:
$ obspy-runtests --all
or via Python interpreter
>>> import obspy.core >>> obspy.core.run_tests(all=True) # DOCTEST: +SKIP
Verbose output:
$ obspy-runtests -v
or
>>> import obspy.core >>> obspy.core.run_tests(verbosity=2) # DOCTEST: +SKIP
Run tests of module obspy.io.mseed:
$ obspy-runtests obspy.io.mseed.tests.suite
or as shortcut:
$ obspy-runtests io.mseed
Run tests of multiple modules, e.g. obspy.io.wav and obspy.io.sac:
$ obspy-runtests io.wav io.sac
Run a specific test case:
$ obspy-runtests obspy.core.tests.test_stats.StatsTestCase.test_init
or
>>> import obspy.core >>> tests = ['obspy.core.tests.test_stats.StatsTestCase.test_init'] >>> obspy.core.run_tests(verbosity=2, tests=tests) # DOCTEST: +SKIP
Report test results to https://tests.obspy.org/:
$ obspy-runtests -r
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