2016-04-07 18:11:32 +00:00
|
|
|
# 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.
|
2014-09-21 14:37:29 +00:00
|
|
|
|
|
|
|
[flake8]
|
|
|
|
max-line-length = 120
|
2016-01-17 16:13:45 +00:00
|
|
|
builtins = _,_n,__request__
|
2016-10-10 17:46:09 +00:00
|
|
|
exclude = .git,.tox,dist,build
|
2015-10-20 18:41:47 +00:00
|
|
|
|
|
|
|
[pep8]
|
|
|
|
max-line-length = 120
|
|
|
|
ignore = E301,E309
|
2014-09-21 14:37:29 +00:00
|
|
|
|
|
|
|
[tox]
|
2016-04-29 22:23:18 +00:00
|
|
|
envlist = py27, flake8, isort, docs, pylint
|
2014-10-09 14:59:45 +00:00
|
|
|
minversion=1.8
|
2014-09-21 14:37:29 +00:00
|
|
|
|
|
|
|
[testenv]
|
2015-07-15 20:17:36 +00:00
|
|
|
passenv = DISPLAY
|
2014-10-03 22:14:20 +00:00
|
|
|
setenv = PYTHONPATH = {env:PWD}:
|
2014-09-25 20:56:15 +00:00
|
|
|
sitepackages = True
|
2014-09-21 14:37:29 +00:00
|
|
|
deps =
|
|
|
|
twisted
|
|
|
|
service_identity
|
|
|
|
mako
|
|
|
|
chardet
|
|
|
|
pyopenssl
|
|
|
|
pyxdg
|
|
|
|
pytest
|
2015-12-15 17:26:55 +00:00
|
|
|
mock
|
2016-05-21 17:53:40 +00:00
|
|
|
slimit
|
2016-11-01 11:30:13 +00:00
|
|
|
pillow
|
2014-09-25 20:56:15 +00:00
|
|
|
whitelist_externals = py.test
|
|
|
|
commands = {envpython} setup.py test
|
2014-09-21 14:37:29 +00:00
|
|
|
|
|
|
|
[pytest]
|
2014-09-25 20:56:15 +00:00
|
|
|
python_functions = test_
|
|
|
|
norecursedirs = .tox .git dist build
|
2014-09-21 14:37:29 +00:00
|
|
|
pep8maxlinelength = 120
|
2014-09-25 20:56:15 +00:00
|
|
|
whitelist_externals= {[testenv]whitelist_externals}
|
2016-05-10 23:49:29 +00:00
|
|
|
commands = py.test --basetemp=_pytest_temp deluge
|
2014-09-21 14:37:29 +00:00
|
|
|
|
2014-10-03 22:14:20 +00:00
|
|
|
|
|
|
|
##############
|
|
|
|
# Unit tests
|
|
|
|
##############
|
2014-09-21 14:37:29 +00:00
|
|
|
|
|
|
|
[testenv:pydef]
|
2014-09-25 20:56:15 +00:00
|
|
|
commands =
|
2016-10-17 11:40:28 +00:00
|
|
|
python -c "import libtorrent as lt; print lt.__version__"
|
2016-05-10 23:49:29 +00:00
|
|
|
py.test -v --basetemp=_pytest_temp -s -m "not (todo or gtkui)" deluge/tests
|
2014-10-13 14:38:51 +00:00
|
|
|
|
|
|
|
[testenv:pygtkui]
|
2016-05-10 23:49:29 +00:00
|
|
|
commands = py.test -v --basetemp=_pytest_temp -s -m "gtkui" deluge/tests
|
2014-10-13 14:38:51 +00:00
|
|
|
|
|
|
|
[testenv:todo]
|
2016-05-10 23:49:29 +00:00
|
|
|
commands = py.test -v --basetemp=_pytest_temp -s -m "todo" deluge/tests
|
2014-10-13 14:38:51 +00:00
|
|
|
|
|
|
|
[testenv:trial]
|
|
|
|
setenv = {[testenv]setenv}:{env:PWD}/deluge/tests
|
|
|
|
whitelist_externals = trial
|
2016-04-07 18:11:32 +00:00
|
|
|
commands = trial --reporter=deluge-reporter deluge/tests
|
2014-09-21 14:37:29 +00:00
|
|
|
|
2014-09-25 13:25:03 +00:00
|
|
|
[testenv:plugins]
|
2016-04-19 14:18:51 +00:00
|
|
|
setenv = PYTHONPATH = {env:PWD}:{env:PWD}/deluge/plugins
|
2016-04-13 19:38:33 +00:00
|
|
|
commands =
|
2016-04-19 14:18:51 +00:00
|
|
|
python setup.py build_plugins --develop --install-dir={env:PWD}/deluge/plugins/
|
2016-05-10 23:49:29 +00:00
|
|
|
py.test -v --basetemp=_pytest_temp -s -m "not gtkui" deluge/plugins
|
2016-04-19 14:18:51 +00:00
|
|
|
|
|
|
|
[testenv:pluginsgtkui]
|
|
|
|
setenv = PYTHONPATH = {env:PWD}:{env:PWD}/deluge/plugins
|
|
|
|
commands =
|
|
|
|
python setup.py build_plugins --develop --install-dir={env:PWD}/deluge/plugins/
|
2016-05-10 23:49:29 +00:00
|
|
|
py.test -v --basetemp=_pytest_temp -s deluge/plugins
|
2014-09-21 14:37:29 +00:00
|
|
|
|
|
|
|
[testenv:py26]
|
2014-09-25 20:56:15 +00:00
|
|
|
basepython = python2.6
|
|
|
|
commands = {[testenv:pydef]commands}
|
2014-09-21 14:37:29 +00:00
|
|
|
|
|
|
|
[testenv:py27]
|
2014-09-25 20:56:15 +00:00
|
|
|
basepython = python2.7
|
|
|
|
commands = {[testenv:pydef]commands}
|
2014-09-21 14:37:29 +00:00
|
|
|
|
2014-10-03 22:14:20 +00:00
|
|
|
|
|
|
|
###########################
|
|
|
|
# Code style verification
|
|
|
|
###########################
|
|
|
|
|
2014-09-21 14:37:29 +00:00
|
|
|
[testenv:isort]
|
|
|
|
deps =
|
|
|
|
{[testenv]deps}
|
2016-05-18 09:03:02 +00:00
|
|
|
isort>=4.2.5
|
2014-09-25 20:56:15 +00:00
|
|
|
whitelist_externals =
|
2014-09-21 14:37:29 +00:00
|
|
|
{[testenv]whitelist_externals}
|
|
|
|
isort
|
2015-07-15 20:17:36 +00:00
|
|
|
commands =
|
|
|
|
isort --version
|
2016-05-22 15:14:46 +00:00
|
|
|
python -c "import subprocess, sys; output = subprocess.check_output(\
|
2016-10-31 11:51:12 +00:00
|
|
|
'isort -q --diff --recursive deluge docs packaging *.py\
|
|
|
|
-o pygtk -o gtk -o gobject -o gtk.gdk -o pango -o cairo -o pangocairo\
|
|
|
|
', shell=True);\
|
2016-05-22 15:14:46 +00:00
|
|
|
print output; sys.exit(bool(output))"
|
2014-09-21 14:37:29 +00:00
|
|
|
|
|
|
|
[testenv:flake8]
|
2016-05-21 17:53:40 +00:00
|
|
|
# Disble site packages to avoid using system flake8 which uses hardcoded python path which imports the wrong libraries.
|
|
|
|
sitepackages = False
|
2014-09-21 14:37:29 +00:00
|
|
|
deps =
|
|
|
|
{[testenv]deps}
|
|
|
|
flake8
|
2016-11-03 22:37:00 +00:00
|
|
|
flake8-quotes
|
2014-09-21 14:37:29 +00:00
|
|
|
pep8-naming
|
2016-01-14 20:18:12 +00:00
|
|
|
commands =
|
|
|
|
flake8 --version
|
|
|
|
flake8
|
2014-09-21 14:37:29 +00:00
|
|
|
|
|
|
|
[testenv:flake8-complexity]
|
2016-05-21 17:53:40 +00:00
|
|
|
sitepackages = False
|
2014-09-21 14:37:29 +00:00
|
|
|
deps =
|
|
|
|
{[testenv:flake8]deps}
|
|
|
|
mccabe
|
2014-09-25 21:58:00 +00:00
|
|
|
commands = flake8 --exit-zero --max-complexity 15 deluge
|
2014-09-21 14:37:29 +00:00
|
|
|
|
2014-10-03 22:14:20 +00:00
|
|
|
|
2016-04-19 17:06:55 +00:00
|
|
|
[testenv:pylint]
|
2016-05-21 17:53:40 +00:00
|
|
|
# Disable site packages to avoid using system installed version
|
|
|
|
sitepackages = False
|
2016-11-02 08:12:55 +00:00
|
|
|
ignore_errors = True
|
2016-04-19 17:06:55 +00:00
|
|
|
deps =
|
|
|
|
{[testenv]deps}
|
|
|
|
pylint
|
2016-05-22 11:43:07 +00:00
|
|
|
# Use bash to enable use of wildcard paths with pylint.
|
2016-05-21 17:53:40 +00:00
|
|
|
whitelist_externals = bash
|
2016-04-19 17:06:55 +00:00
|
|
|
commands =
|
|
|
|
pylint --version
|
|
|
|
pylint deluge
|
2016-05-08 16:53:49 +00:00
|
|
|
bash -c 'pylint *.py deluge/scripts/*.py'
|
|
|
|
bash -c 'pylint deluge/plugins/*/deluge/'
|
2016-04-19 17:06:55 +00:00
|
|
|
|
|
|
|
|
2014-10-03 22:14:20 +00:00
|
|
|
######################
|
|
|
|
# Unit Test coverage
|
|
|
|
######################
|
|
|
|
|
|
|
|
[testcoveragebase]
|
|
|
|
deps =
|
|
|
|
{[testenv]deps}
|
|
|
|
pytest-cov
|
|
|
|
coverage
|
|
|
|
whitelist_externals =
|
|
|
|
{[testenv]whitelist_externals}
|
|
|
|
coverage
|
2016-04-07 18:11:32 +00:00
|
|
|
commands = coverage run --branch --source=deluge -m py.test -m "not todo" deluge/tests/
|
2014-10-03 22:14:20 +00:00
|
|
|
|
|
|
|
[testenv:testcoverage]
|
|
|
|
setenv = {[testenv]setenv}
|
2016-04-07 18:11:32 +00:00
|
|
|
deps = {[testcoveragebase]deps}
|
2014-10-03 22:14:20 +00:00
|
|
|
whitelist_externals = {[testcoveragebase]whitelist_externals}
|
|
|
|
commands =
|
|
|
|
{[testcoveragebase]commands}
|
|
|
|
coverage report
|
|
|
|
|
|
|
|
[testenv:testcoverage-html]
|
|
|
|
setenv = {[testenv]setenv}
|
2016-04-07 18:11:32 +00:00
|
|
|
deps = {[testcoveragebase]deps}
|
2014-10-03 22:14:20 +00:00
|
|
|
whitelist_externals = {[testcoveragebase]whitelist_externals}
|
|
|
|
commands =
|
|
|
|
{[testcoveragebase]commands}
|
|
|
|
coverage html -d docs/build/htmlcoverage
|
|
|
|
|
|
|
|
|
|
|
|
######################
|
|
|
|
# Docs generation
|
|
|
|
######################
|
|
|
|
|
2014-09-25 21:12:00 +00:00
|
|
|
# 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.
|
2014-09-21 14:37:29 +00:00
|
|
|
|
2014-09-25 21:12:00 +00:00
|
|
|
[docsbase]
|
2014-09-25 20:56:15 +00:00
|
|
|
sitepackages = False
|
|
|
|
changedir = docs
|
2014-09-21 14:37:29 +00:00
|
|
|
deps =
|
|
|
|
{[testenv]deps}
|
|
|
|
sphinx
|
|
|
|
sphinxcontrib-napoleon
|
2016-04-07 18:11:32 +00:00
|
|
|
whitelist_externals =
|
|
|
|
{[testenv]whitelist_externals}
|
2014-09-25 21:12:00 +00:00
|
|
|
|
|
|
|
[testenv:docs]
|
2014-09-25 20:56:15 +00:00
|
|
|
sitepackages = {[docsbase]sitepackages}
|
|
|
|
deps = {[docsbase]deps}
|
2016-10-19 11:53:32 +00:00
|
|
|
whitelist_externals =
|
|
|
|
bash
|
2016-05-21 17:53:40 +00:00
|
|
|
commands =
|
2016-10-19 11:53:32 +00:00
|
|
|
bash -c 'rm -f docs/source/modules/*.rst'
|
2016-05-25 10:06:48 +00:00
|
|
|
python -c "print '> sphinx-apidoc --force -o docs/source/modules/ deluge deluge/plugins\n'\
|
|
|
|
'> sphinx-build -v -E -T -b html -d docs/build/doctrees docs/source docs/build/html';\
|
|
|
|
import subprocess, sys; proc = subprocess.Popen(\
|
2016-05-22 15:14:46 +00:00
|
|
|
'python setup.py build_docs', shell=True, stderr=subprocess.PIPE);\
|
|
|
|
err = proc.communicate()[1]; print err; sys.exit(bool(err))"
|
2014-09-25 21:12:00 +00:00
|
|
|
|
|
|
|
[testenv:docscoverage]
|
2014-09-25 20:56:15 +00:00
|
|
|
sitepackages = {[docsbase]sitepackages}
|
|
|
|
changedir = {[docsbase]changedir}
|
|
|
|
deps =
|
2014-09-25 21:12:00 +00:00
|
|
|
{[docsbase]deps}
|
|
|
|
coverage
|
|
|
|
pytest-cov
|
2016-04-07 18:11:32 +00:00
|
|
|
whitelist_externals =
|
|
|
|
{[docsbase]whitelist_externals}
|
|
|
|
mkdir
|
2014-09-25 20:56:15 +00:00
|
|
|
commands =
|
2014-09-25 21:12:00 +00:00
|
|
|
mkdir -p build/doccoverage
|
|
|
|
sphinx-build -W -b coverage -d build/doctrees source build/doccoverage
|
|
|
|
py.test --doctest-glob='*.rst'
|