Add tox usage to testing docs (#915)

* Use section header for CI testing in style guide document
* Add tox section to style guide document
* Reword style guide's testing section to be more general after introduction of integration tests
This commit is contained in:
Brett Sun 2016-12-08 17:10:48 +01:00 committed by GitHub
parent 6f90c8f3df
commit 86019d51eb
1 changed files with 27 additions and 4 deletions

View File

@ -73,13 +73,13 @@ flake8 --max-line-length 119 bigchaindb/
```
## Writing and Running (Python) Unit Tests
## Writing and Running (Python) Tests
We write unit tests for our Python code using the [pytest](http://pytest.org/latest/) framework.
We write unit and integration tests for our Python code using the [pytest](http://pytest.org/latest/) framework.
All tests go in the `bigchaindb/tests` directory or one of its subdirectories. You can use the tests already in there as templates or examples.
You can run all unit tests using:
You can run all tests using:
```text
py.test -v
```
@ -96,4 +96,27 @@ python setup.py test
If you want to learn about all the things you can do with pytest, see [the pytest documentation](http://pytest.org/latest/).
**Automated testing of pull requests.** We use [Travis CI](https://travis-ci.com/), so that whenever someone creates a new BigchainDB pull request on GitHub, Travis CI gets the new code and does _a bunch of stuff_. You can find out what we tell Travis CI to do in [the `.travis.yml` file](.travis.yml): it tells Travis CI how to install BigchainDB, how to run all the tests, and what to do "after success" (e.g. run `codecov`). (We use [Codecov](https://codecov.io/) to get a rough estimate of our test coverage.)
### Tox
We use [tox](https://tox.readthedocs.io/en/latest/) to run multiple suites of tests against multiple environments during automated testing. Generally you don't need to run this yourself, but it might be useful when troubleshooting a failing CI build.
To run all the tox tests, use:
```text
tox
```
or:
```text
python -m tox
```
To run only a few environments, use the `-e` flag:
```text
tox -e {ENVLIST}
```
where `{ENVLIST}` is one or more of the environments specified in the [tox.ini file](tox.ini).
### Automated testing of pull requests
We use [Travis CI](https://travis-ci.com/), so that whenever someone creates a new BigchainDB pull request on GitHub, Travis CI gets the new code and does _a bunch of stuff_. You can find out what we tell Travis CI to do in [the `.travis.yml` file](.travis.yml): it tells Travis CI how to install BigchainDB, how to run all the tests, and what to do "after success" (e.g. run `codecov`). (We use [Codecov](https://codecov.io/) to get a rough estimate of our test coverage.)