mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Developer-specific notes on running unit tests
This commit is contained in:
parent
70560408cd
commit
4b4df442d5
@ -55,12 +55,27 @@ 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."
|
||||
|
||||
|
||||
## Writing (Python) Tests
|
||||
## Writing and Running (Python) Unit Tests
|
||||
|
||||
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.
|
||||
|
||||
The BigchainDB Documentation has a [section explaining how to run all unit tests](http://bigchaindb.readthedocs.org/en/master/running-unit-tests.html).
|
||||
You can run all unit 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/).
|
||||
|
||||
**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.)
|
||||
|
Loading…
x
Reference in New Issue
Block a user