summaryrefslogtreecommitdiff
path: root/CONTRIBUTING.md
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2021-04-01 10:52:52 -0500
committerJordan Cook <jordan.cook@pioneer.com>2021-04-01 10:57:34 -0500
commit802b499b679f0292cd3d2c87b89822746c5f20ad (patch)
tree933bcdfb180bdcecf7f6356f27c6e5c5f5bfa28c /CONTRIBUTING.md
parent4196c138d00f92ef3f55da8bbb4818c180d5f7d7 (diff)
downloadrequests-cache-802b499b679f0292cd3d2c87b89822746c5f20ad.tar.gz
Add an example test runner script, and add some more testing info to docs
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r--CONTRIBUTING.md21
1 files changed, 20 insertions, 1 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6b2e7e6..80303fe 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -37,6 +37,8 @@ $ pre-commit uninstall
```
## Testing
+
+### Test Layout
* Tests are divided into unit and integration tests:
* Unit tests can be run without any additional setup, and don't depend on any external services
* Integration tests depend on additional services, which are easiest to run using Docker
@@ -44,9 +46,16 @@ $ pre-commit uninstall
* See [conftest.py](https://github.com/reclosedev/requests-cache/blob/master/tests/conftest.py) for
[pytest fixtures](https://docs.pytest.org/en/stable/fixture.html) that apply the most common
mocking steps and other test setup.
+
+### Running Tests
+* Run `pytest` to run all tests
+* Run `pytest tests/unit` to run only unit tests
+* Run `pytest tests/integration` to run only integration tests
+* Run `./runtests.sh` to run all tests with some useful options for test coverage reports,
+ multiprocessing, and debugging.
### Integration Tests
-Local databases are required to run integration tests, and docker-compose config is included to make
+Live databases are required to run integration tests, and docker-compose config is included to make
this easier. First, [install docker](https://docs.docker.com/get-docker/) and
[install docker-compose](https://docs.docker.com/compose/install/).
@@ -56,6 +65,16 @@ $ docker-compose up -d
pytest tests/integration
```
+## Debugging
+When you run into issues while working on new features and/or tests, it will make your life much easier
+to use a debugger instead of haphazard `print` statements. Most IDEs have a built-in debugger, but if
+you prefer the command line, [ipdb](https://github.com/gotcha/ipdb) is a good option. To install:
+```bash
+pip install ipython ipdb
+```
+
+The `runtests.sh` script will use ipdb by default, if it's installed.
+
## Documentation
[Sphinx](http://www.sphinx-doc.org/en/master/) is used to generate documentation.