Gitlab will migrate to a new storage backend starting 0300 UTC on 2020-04-04. We do not anticipate a maintenance window for this migration. Performance may be impacted over the weekend. Thanks for your patience.

Commit a5d74e4c authored by Tanner Prestegard's avatar Tanner Prestegard

Update testing and contributing docs

parent 650b267c
......@@ -72,14 +72,18 @@ To run the unit tests with the current version of Python, do::
python setup.py 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 setup.py integration_test
python setup.py test --addopts "-m integration"
# Integration tests of the command-line interface
python setup.py test --addopts "ligo/gracedb/test/integration/test_cli.py"
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 setup.py test --addopts "-m cli"
# Only unit tests of CLI
python setup.py 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:
```bash
python setup.py 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:
```bash
python setup.py integration_test
```
Run the integration tests for the command-line client:
```bash
python setup.py test --addops "ligo/gracedb/test/integration/test_cli.py"
```
## Test compatibility with different versions of Python
Install tox:
```bash
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:
```bash
tox
```
Run unit tests only:
```bash
tox -e $(tox -l | grep unit_test | paste -sd "," -)
```
Run integration tests only:
```bash
tox -e $(tox -l | grep integration_test | paste -sd "," -)
```
Run all tests with one version of Python:
```bash
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 https://gracedb-test.ligo.org/api/
To change this, you can add
TEST_SERVICE={url}
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 base.py and test.sh for more info about test data)
## Running integration tests
To run all integration tests:
```bash
python setup.py integration_test
```
To only run certain ones, you can do something like
```bash
# For standard test classes
python setup.py integration_test -s ligo.gracedb.test.integration.test_superevents.TestSuperevents
# For specially ordered test suites
python setup.py integration_test -s ligo.gracedb.test.integration.test_voevents.VOEventTestSuite
```
## Adding integration tests
In ligo/gracedb/test/integration/__init__.py, add the following:
```python
# 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/test.sh`.
Otherwise, go to the root of this repository and run
```bash
PYTHONPATH=. GRACEDB='python bin/gracedb' ligo/gracedb/test/integration/test.sh
```
......@@ -115,8 +115,6 @@ setup(
package_data={
'ligo.gracedb.test': [
'integration/data/*',
'integration/test.sh',
'integration/README',
],
},
entry_points={
......
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