1 | | [[PageOutline(2-4,,inline)]] |
2 | | |
3 | | = Unit Testing = |
4 | | |
5 | | Deluge testing is implemented using Trial which is Twisted's testing framework and an extension of Python's unittest. Full documentation for Trial can be found on the Twisted website: |
6 | | |
7 | | * [http://twistedmatrix.com/trac/wiki/TwistedTrial Twisted Trial] |
8 | | * [http://twistedmatrix.com/documents/current/core/howto/testing.html Writing tests using Trial] |
9 | | * [http://twistedmatrix.com/documents/11.1.0/api/twisted.trial.unittest.html Trial Unittest Docs] |
10 | | |
11 | | == Development branch (git develop) == |
12 | | |
13 | | The tests are located in the source folder under `deluge/tests`. |
14 | | |
15 | | The tests are run from the project root directory. |
16 | | |
17 | | View the unit test coverage on: http://deluge-torrent.github.io |
18 | | |
19 | | Here are some examples that show running all the test through to selecting an individual test. |
20 | | {{{ |
21 | | trial deluge |
22 | | trial deluge.tests.test_client |
23 | | trial deluge.tests.test_client.ClientTestCase |
24 | | trial deluge.tests.test_client.ClientTestCase.test_connect_localclient |
25 | | }}} |
26 | | |
27 | | Running the tests for a specific plugin (requires [https://pypi.python.org/pypi/pytest pytest]): |
28 | | {{{ |
29 | | pytest deluge/plugins/<name-of-plugin> |
30 | | }}} |
31 | | |
32 | | === Tox === |
33 | | All the tests for Deluge can be run using [https://pypi.python.org/pypi/tox tox] |
34 | | |
35 | | See available targets: |
36 | | {{{ |
37 | | tox -l |
38 | | py27 |
39 | | flake8 |
40 | | isort |
41 | | docs |
42 | | }}} |
43 | | |
44 | | Run specific test: |
45 | | {{{ |
46 | | tox -e pydef |
47 | | }}} |
48 | | |
49 | | Verify code with flake8 and isort: |
50 | | {{{ |
51 | | tox -e flake8,isort |
52 | | }}} |
53 | | |
54 | | === Travis-ci === |
55 | | Deluge develop branch is tested automatically by [https://travis-ci.org/deluge-torrent/deluge Travis-ci] |
56 | | |
57 | | When creating a pull request (PR) on [https://github.com/deluge-torrent/deluge/pulls github], Travis will be automatically run the unit tests with the code in the PR. |
58 | | |
59 | | |
60 | | == 1.3 branch == |
61 | | |
62 | | The tests are located in the top level folder of source under `tests`. |
63 | | {{{ |
64 | | cd tests |
65 | | trial *.py |
66 | | trial test_common |
67 | | trial test_common.CommonTestCase |
68 | | trial test_common.CommonTestCase.test_is_ip |
69 | | }}} |
| 1 | Moved to: https://deluge.readthedocs.io/en/develop/contributing/testing.html |