aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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)