mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Merge pull request #143 from bigchaindb/feat/140/add-section-about-running-tests-in-docs
Move info on running all unit tests into the Sphinx docs
This commit is contained in:
commit
9da2a3c943
@ -57,46 +57,10 @@ we use the `format()` version. The [official Python documentation says](https://
|
||||
|
||||
## Writing (Python) Tests
|
||||
|
||||
We write tests for our Python code using the [pytest](http://pytest.org/latest/) framework.
|
||||
We write unit 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.
|
||||
|
||||
### Standard Ways to Run All Tests
|
||||
The BigchainDB Documentation has a [section explaining how to run all unit tests](http://bigchaindb.readthedocs.org/en/develop/running-unit-tests.html).
|
||||
|
||||
To run all the tests, first make sure you have RethinkDB running:
|
||||
```text
|
||||
$ rethinkdb
|
||||
```
|
||||
|
||||
then in another terminal, do:
|
||||
```text
|
||||
$ py.test -v
|
||||
```
|
||||
|
||||
If that doesn't work (e.g. maybe you are running in a conda virtual environment), try:
|
||||
```text
|
||||
$ python -m pytest -v
|
||||
```
|
||||
|
||||
You can also run all tests via `setup.py`, using:
|
||||
```text
|
||||
$ python setup.py test
|
||||
```
|
||||
|
||||
### Using `docker-compose` to Run the Tests
|
||||
|
||||
You can use `docker-compose` to run the tests. (You don't have to start RethinkDB first: `docker-compose` does that on its own, when it reads the `docker-compose.yml` file.)
|
||||
|
||||
First, build the images (~once), using:
|
||||
```text
|
||||
$ docker-compose build
|
||||
```
|
||||
|
||||
then run the tests using:
|
||||
```text
|
||||
$ docker-compose run --rm bigchaindb py.test -v
|
||||
```
|
||||
|
||||
### Automated Testing of All 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.)
|
||||
**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.)
|
||||
|
@ -14,6 +14,7 @@ Table of Contents
|
||||
|
||||
introduction
|
||||
installing-server
|
||||
running-unit-tests
|
||||
python-server-api-examples
|
||||
bigchaindb-cli
|
||||
http-client-server-api
|
||||
|
41
docs/source/running-unit-tests.md
Normal file
41
docs/source/running-unit-tests.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Running Unit Tests
|
||||
|
||||
Once you've installed BigchainDB Server, you may want to run all the unit tests. This section explains how.
|
||||
|
||||
First of all, if you installed BigchainDB Server using `pip` (i.e. by getting the package from PyPI), then you didn't install the tests. Before you can run all the unit tests, you must [install BigchainDB from source](http://bigchaindb.readthedocs.org/en/develop/installing-server.html#how-to-install-bigchaindb-from-source).
|
||||
|
||||
To run all the unit tests, first make sure you have RethinkDB running:
|
||||
```text
|
||||
$ rethinkdb
|
||||
```
|
||||
|
||||
then in another terminal, do:
|
||||
```text
|
||||
$ py.test -v
|
||||
```
|
||||
|
||||
If the above command doesn't work (e.g. maybe you are running in a conda virtual environment), try:
|
||||
```text
|
||||
$ python -m pytest -v
|
||||
```
|
||||
|
||||
(We write our unit tests using the [pytest](http://pytest.org/latest/) framework.)
|
||||
|
||||
You can also run all unit tests via `setup.py`, using:
|
||||
```text
|
||||
$ python setup.py test
|
||||
```
|
||||
|
||||
### Using `docker-compose` to Run the Tests
|
||||
|
||||
You can also use `docker-compose` to run the unit tests. (You don't have to start RethinkDB first: `docker-compose` does that on its own, when it reads the `docker-compose.yml` file.)
|
||||
|
||||
First, build the images (~once), using:
|
||||
```text
|
||||
$ docker-compose build
|
||||
```
|
||||
|
||||
then run the unit tests using:
|
||||
```text
|
||||
$ docker-compose run --rm bigchaindb py.test -v
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user