diff --git a/PYTHON_STYLE_GUIDE.md b/PYTHON_STYLE_GUIDE.md index 42f18c85..1c29117e 100644 --- a/PYTHON_STYLE_GUIDE.md +++ b/PYTHON_STYLE_GUIDE.md @@ -65,7 +65,7 @@ x = 'name: {}; score: {}'.format(name, n) we use the `format()` version. The [official Python documentation says](https://docs.python.org/2/library/stdtypes.html#str.format), "This method of string formatting is the new standard in Python 3, and should be preferred to the % formatting described in String Formatting Operations in new code." -## Runnng the Flake8 Style Checker +## Running the Flake8 Style Checker We use [Flake8](http://flake8.pycqa.org/en/latest/index.html) to check our Python code style. Once you have it installed, you can run it using: ```text @@ -75,48 +75,6 @@ flake8 --max-line-length 119 bigchaindb/ ## Writing and Running (Python) Tests -We write unit and integration tests for our Python code using the [pytest](http://pytest.org/latest/) framework. +The content of this section was moved to [`bigchiandb/tests/README.md`](./tests/README.md). -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 tests using: -```text -py.test -v -``` - -or, if that doesn't work, try: -```text -python -m pytest -v -``` - -or: -```text -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/). - -### 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.) +Note: We automatically run all tests on all pull requests (using Travis CI), so you should definitely run all tests locally before you submit a pull request. See the above-linked README file for instructions. \ No newline at end of file diff --git a/tests/README.md b/tests/README.md index 1c0a734e..d68788bc 100644 --- a/tests/README.md +++ b/tests/README.md @@ -10,9 +10,64 @@ A few notes: [`bigchaindb/common/`](../bigchaindb/common/) - [`bigchaindb/tests/db/`](./db/) contains tests requiring the database backend (e.g. RethinkDB) -## Pytest Customizations -Customizations we've added to `pytest`: +## Writing Tests + +We write unit and integration tests for our Python code using the [pytest](http://pytest.org/latest/) framework. You can use the tests in the `bigchaindb/tests/` folder as templates or examples. + + +## Running Tests + +You can run all tests using: +```text +py.test -v +``` + +or, if that doesn't work, try: +```text +python -m pytest -v +``` + +or: +```text +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/). + + +### Our pytest Customizations + +Customizations we've added to pytest: - `--database-backend`: Defines the backend to use for the tests. Must be one of the backends available in the [server configuration](https://docs.bigchaindb.com/projects/server/en/latest/server-reference/configuration.html) + + + + +## 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). \ No newline at end of file