aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodl <[email protected]>2017-11-28 14:11:00 +0100
committercodl <[email protected]>2017-11-28 14:12:15 +0100
commitd41e4f42d5d3d222498c8f8b9a91c70b3c5a97e2 (patch)
treea219b7031409c3466683e6aebaa32bf23a1e3da7 /tests/README.markdown
parent95777fe58e2c61640e377f447594b9c4f4f91542 (diff)
downloadmastodon.py-d41e4f42d5d3d222498c8f8b9a91c70b3c5a97e2.tar.gz
add test documentation
Diffstat (limited to 'tests/README.markdown')
-rw-r--r--tests/README.markdown40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/README.markdown b/tests/README.markdown
new file mode 100644
index 0000000..ad27a31
--- /dev/null
+++ b/tests/README.markdown
@@ -0,0 +1,40 @@
1## Running
2
3To run this test suite, install the testing dependencies:
4
5 pip install -e .[test]
6
7Then, run `pytest`.
8
9If you wish to check test coverage:
10
11 pytest --cov=mastodon
12
13And if you want a complete HTML coverage report:
14
15 pytest --cov=mastodon --cov-report html:coverage
16 # then open coverage/index.html in your favourite web browser
17
18
19## Contributing
20
21[VCR.py]: https://vcrpy.readthedocs.io/
22
23This test suite uses [VCR.py][] to record requests to Mastodon and replay them in successive runs.
24
25If you want to add or change tests, you will need a Mastodon development server running on `http://localhost:3000`, with the default `admin` user and default password.
26
27It also needs a test OAuth app to be set up by applying the provided `setup_app.sql` to Mastodon's database:
28
29 psql -d mastodon_development < tests/setup_app.sql
30
31Tests that send requests to Mastodon should be marked as needing VCR with the `pytest.mark.vcr` decorator.
32
33```python
34import pytest
35
36@pytest.mark.vcr()
37def test_fun_new_feature(api):
38 foo = api.fun_new_feature()
39 assert foo = "bar"
40```
Powered by cgit v1.2.3 (git 2.41.0)