summaryrefslogtreecommitdiffstats
path: root/docs/source/contributing/testing.md
blob: 4df8ca669207df3ea5bcc2b83aa9068e481d85d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Running tests

Deluge testing is implemented using Trial which is Twisted's testing framework
and an extension of Python's unittest.

See Twisted website for documentation on [Twisted Trial](http://twistedmatrix.com/trac/wiki/TwistedTrial)
and [Writing tests using Trial](http://twistedmatrix.com/documents/current/core/howto/testing.html).

## Testing

The tests are located in the source folder under `deluge/tests`.
The tests are run from the project root directory.
View the unit test coverage at: [deluge-torrent.github.io](http://deluge-torrent.github.io)

### Trial

Here are some examples that show running all the tests through to selecting an
individual test.

    trial deluge
    trial deluge.tests.test_client
    trial deluge.tests.test_client.ClientTestCase
    trial deluge.tests.test_client.ClientTestCase.test_connect_localclient

### Pytest

    pytest deluge/tests
    pytest deluge/tests/test_client.py
    pytest deluge/tests/test_client.py -k test_connect_localclient

### Plugin

Running the tests for a specific plugin (requires [pytest](https://pypi.python.org/pypi/pytest)):

    pytest deluge/plugins/<name-of-plugin>

## Tox

All the tests for Deluge can be run using [Tox](https://pypi.python.org/pypi/tox)

### See available targets:

    tox -l
    py27
    py3
    lint
    docs

### Run specific test:

    tox -e py3

### Verify code with pre-commit:

    tox -e lint

## Travis CI

Deluge develop branch is tested automatically by [Travis].
When creating a pull request (PR) on [github], Travis will automatically run
the unit tests with the code in the PR.

[travis]: https://travis-ci.org/deluge-torrent/deluge
[github]: https://github.com/deluge-torrent/deluge/pulls