From 785ee388fefba8fb1769dc0de0330f30ea9bc891 Mon Sep 17 00:00:00 2001 From: troymc Date: Thu, 17 Mar 2016 16:20:11 +0100 Subject: [PATCH] Move info on running all unit tests into the Sphinx docs --- PYTHON_STYLE_GUIDE.md | 42 +++---------------------------- docs/source/index.rst | 1 + docs/source/running-unit-tests.md | 41 ++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 39 deletions(-) create mode 100644 docs/source/running-unit-tests.md diff --git a/PYTHON_STYLE_GUIDE.md b/PYTHON_STYLE_GUIDE.md index dc7e68d7..4d4d4888 100644 --- a/PYTHON_STYLE_GUIDE.md +++ b/PYTHON_STYLE_GUIDE.md @@ -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.) diff --git a/docs/source/index.rst b/docs/source/index.rst index 44523c7d..fd2c991e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -14,6 +14,7 @@ Table of Contents introduction installing-server + running-unit-tests python-server-api-examples bigchaindb-cli http-client-server-api diff --git a/docs/source/running-unit-tests.md b/docs/source/running-unit-tests.md new file mode 100644 index 00000000..9e53dc77 --- /dev/null +++ b/docs/source/running-unit-tests.md @@ -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 +```