summaryrefslogtreecommitdiffstats
path: root/tox.ini
blob: a047931db57c5d2590e39d9eac1e0cc264f71dc1 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# Tox (http://tox.testrun.org/) is a tool for running tests in multiple virtualenvs.
# This configuration file will run the test suite on all supported python versions.
#
# Usage: `pip install tox` and then run `tox` from this directory.

[flake8]
max-line-length = 120
builtins = _,__request__
exclude = .git,dist,build

[pep8]
max-line-length = 120
ignore = E301,E309

[tox]
envlist = py27, flake8, isort, docs, pylint
minversion=1.8

[testenv]
passenv = DISPLAY
setenv = PYTHONPATH = {env:PWD}:
sitepackages = True
deps =
    twisted
    service_identity
    mako
    chardet
    pyopenssl
    pyxdg
    pytest
    mock
whitelist_externals = py.test
commands = {envpython} setup.py test

[pytest]
python_functions = test_
norecursedirs = .tox .git dist build
pep8maxlinelength = 120
whitelist_externals= {[testenv]whitelist_externals}
commands = py.test deluge


##############
# Unit tests
##############

[testenv:pydef]
commands =
    python -c "import libtorrent as lt; print lt.version"
    py.test -v -s -m "not (todo or gtkui)" deluge/tests

[testenv:pygtkui]
commands = py.test -v -s -m "gtkui" deluge/tests

[testenv:todo]
commands = py.test -v -s -m "todo" deluge/tests

[testenv:trial]
setenv = {[testenv]setenv}:{env:PWD}/deluge/tests
whitelist_externals = trial
commands = trial --reporter=deluge-reporter deluge/tests

[testenv:plugins]
setenv = PYTHONPATH = {env:PWD}:{env:PWD}/deluge/plugins
commands =
    python setup.py build_plugins --develop --install-dir={env:PWD}/deluge/plugins/
    py.test -v -s -m "not gtkui" deluge/plugins

[testenv:pluginsgtkui]
setenv = PYTHONPATH = {env:PWD}:{env:PWD}/deluge/plugins
commands =
    python setup.py build_plugins --develop --install-dir={env:PWD}/deluge/plugins/
    py.test  -v -s deluge/plugins

[testenv:py26]
basepython = python2.6
commands = {[testenv:pydef]commands}

[testenv:py27]
basepython = python2.7
commands = {[testenv:pydef]commands}


###########################
# Code style verification
###########################

[testenv:isort]
deps =
    {[testenv]deps}
    isort>=4.2.0
whitelist_externals =
    {[testenv]whitelist_externals}
    isort
commands =
    isort --version
    python -c "import subprocess, sys; output = subprocess.check_output('isort -q --diff --recursive deluge docs packaging *.py', shell=True); print output; sys.exit(len(output) != 0)"

[testenv:flake8]
# Force flake8 pip install as system flake8 uses hardcoded python path which imports the wrong libraries.
install_command = pip -v install --ignore-installed {opts} {packages}
setenv = {[testenv]setenv}
deps =
    {[testenv]deps}
    flake8
    pep8-naming
commands =
    flake8 --version
    flake8

[testenv:flake8-complexity]
setenv = {[testenv]setenv}
deps =
    {[testenv:flake8]deps}
    mccabe
commands = flake8 --exit-zero --max-complexity 15 deluge


[testenv:pylint]
# Force pylint pip install to avoid using system installed version
install_command = pip -v install --ignore-installed {opts} {packages}
setenv = {[testenv]setenv}
deps =
    {[testenv]deps}
    pylint
commands =
    pylint --version
    pylint deluge


######################
# Unit Test coverage
######################

[testcoveragebase]
#install_command = pip install {opts} {packages}
deps =
    {[testenv]deps}
    pytest-cov
    coverage
whitelist_externals =
    {[testenv]whitelist_externals}
    coverage
commands = coverage run --branch --source=deluge -m py.test -m "not todo" deluge/tests/

[testenv:testcoverage]
setenv = {[testenv]setenv}
deps = {[testcoveragebase]deps}
whitelist_externals = {[testcoveragebase]whitelist_externals}
commands =
    {[testcoveragebase]commands}
    coverage report

[testenv:testcoverage-html]
setenv = {[testenv]setenv}
deps = {[testcoveragebase]deps}
whitelist_externals = {[testcoveragebase]whitelist_externals}
commands =
    {[testcoveragebase]commands}
    coverage html -d docs/build/htmlcoverage


######################
# Docs generation
######################

# We do not have all dependencies on RTD and travis so we exclude the
# site packages (sitepackages=False) when building docs so that local
# tests have a similar environment.

[docsbase]
sitepackages = False
changedir = docs
install_command = pip install {opts} {packages}
deps =
    {[testenv]deps}
    sphinx
    sphinxcontrib-napoleon
    pillow
whitelist_externals =
    {[testenv]whitelist_externals}
    sphinx-build
commands = sphinx-build -E -W -b html -d build/doctrees source build/html

[testenv:docs]
sitepackages = {[docsbase]sitepackages}
changedir = {[docsbase]changedir}
install_command = {[docsbase]install_command}
deps = {[docsbase]deps}
whitelist_externals = {[docsbase]whitelist_externals}
commands = sphinx-build -v -E -T -b html -d build/doctrees source build/html

[testenv:docscoverage]
sitepackages = {[docsbase]sitepackages}
changedir = {[docsbase]changedir}
install_command = {[docsbase]install_command}
deps =
    {[docsbase]deps}
    coverage
    pytest-cov
whitelist_externals =
    {[docsbase]whitelist_externals}
    mkdir
commands =
    mkdir -p build/doccoverage
    sphinx-build -W -b coverage -d build/doctrees source build/doccoverage
    py.test --doctest-glob='*.rst'