Verified Commit a5d74e4c authored by Tanner Prestegard's avatar Tanner Prestegard
Browse files

Update testing and contributing docs

parent 650b267c
......@@ -72,14 +72,18 @@ To run the unit tests with the current version of Python, do::
python test
We are presently moving away from the ``unittest`` framework, but several of the older tests are written in that style.
As a result, there are two separate commands for running the integration tests::
To run the integration tests, you can do::
# Integration tests of the Python module
python integration_test
python test --addopts "-m integration"
# Integration tests of the command-line interface
python test --addopts "ligo/gracedb/test/integration/"
A pytest mark is also used to distinguish tests of the command-line interface.
If you want to run those tests specifically, you can do::
# All CLI-related tests
python test --addopts "-m cli"
# Only unit tests of CLI
python test --addopts "-m 'cli and not integration'"
Comprehensive testing
......@@ -104,12 +108,6 @@ To run the client integration tests only, with all Python versions::
tox -e $(tox -l | grep integration_test | paste -sd "," -)
To run the **command-line interface** integration tests only, with all Python versions::
tox -e $(tox -l | grep integration_test_cli | paste -sd "," -)
**NOTE:** this is separate from the main Python module integration tests due to a quirk of how the custom ``integration_test`` command is defined.
This should be resolved in the future by converting all tests from the ``unittest`` format to use ``pytest`` and setting ``pytest`` marks appropriately.
To run all unit and integration tests with a specific Python version::
# Testing
Information on how to run the package's unit tests and integration tests.
## Unit tests
Run the package's unit tests:
python test
## Integration tests
To test the package's compatibility with a GraceDB server requires a superuser account on the server.
Run the integration tests for the Python package:
python integration_test
Run the integration tests for the command-line client:
python test --addops "ligo/gracedb/test/integration/"
## Test compatibility with different versions of Python
Install tox:
pip install tox
The current [tox configuration](../../../tox.ini) runs the tests with Python 2.7 and 3.4-3.7. If your system does not have one of those interpreters, it will be skipped.
Run all tests with all specified versions of Python:
Run unit tests only:
tox -e $(tox -l | grep unit_test | paste -sd "," -)
Run integration tests only:
tox -e $(tox -l | grep integration_test | paste -sd "," -)
Run all tests with one version of Python:
tox -e $(tox -l | grep py27 | paste -sd "," -)
# Integration testing for ligo-gracedb
*Last updated 15 Jan 2019*
## General information
The default GraceDB service for tests is at
To change this, you can add
to the beginning of any of the above commands. Or, you can set TEST_SERVICE
in your environment and then run these commands:
export TEST_SERVICE={url}
To use custom test data, set TEST_DATA_DIR. (see and for more info about test data)
## Running integration tests
To run all integration tests:
python integration_test
To only run certain ones, you can do something like
# For standard test classes
python integration_test -s ligo.gracedb.test.integration.test_superevents.TestSuperevents
# For specially ordered test suites
python integration_test -s ligo.gracedb.test.integration.test_voevents.VOEventTestSuite
## Adding integration tests
In ligo/gracedb/test/integration/, add the following:
# Import new test class or suite
from .test_new import NewTestClass, NewTestSuite
# If it's a standard test class, add it to the list of test classes
testClasses = [..., NewTestClass]
# Or, for a suite, add it to the list of test suites
test_suites = [..., NewTestSuite]
## Command-line interface integration tests
If using a virtualenv with ligo-gracedb installed, do `ligo/gracedb/test/integration/`.
Otherwise, go to the root of this repository and run
PYTHONPATH=. GRACEDB='python bin/gracedb' ligo/gracedb/test/integration/
......@@ -115,8 +115,6 @@ setup(
'ligo.gracedb.test': [
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment