deluge/tox.ini

212 lines
5.2 KiB
INI
Raw Normal View History

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.
[flake8]
max-line-length = 120
builtins = _,__request__
exclude = .git,dist,build
[pep8]
max-line-length = 120
ignore = E301,E309
[tox]
2016-04-29 22:23:18 +00:00
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]
2016-04-07 18:11:32 +00:00
commands = py.test -v -s -m "gtkui" deluge/tests
[testenv:todo]
2016-04-07 18:11:32 +00:00
commands = py.test -v -s -m "todo" deluge/tests
[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-25 13:25:03 +00:00
[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}
2015-10-20 23:34:49 +00:00
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
2014-09-25 21:58:00 +00:00
commands = flake8 --exit-zero --max-complexity 15 deluge
2016-04-19 17:06:55 +00:00
[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
whitelist_externals =
bash
2016-04-19 17:06:55 +00:00
commands =
pylint --version
pylint deluge
bash -c 'pylint *.py deluge/scripts/*.py'
bash -c 'pylint deluge/plugins/*/deluge/'
2016-04-19 17:06:55 +00:00
######################
# Unit Test coverage
######################
[testcoveragebase]
#install_command = pip install {opts} {packages}
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/
[testenv:testcoverage]
setenv = {[testenv]setenv}
2016-04-07 18:11:32 +00:00
deps = {[testcoveragebase]deps}
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}
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-25 21:12:00 +00:00
[docsbase]
sitepackages = False
changedir = docs
install_command = pip install {opts} {packages}
deps =
{[testenv]deps}
sphinx
sphinxcontrib-napoleon
pillow
2016-04-07 18:11:32 +00:00
whitelist_externals =
{[testenv]whitelist_externals}
sphinx-build
commands = sphinx-build -E -W -b html -d build/doctrees source build/html
2014-09-25 21:12:00 +00:00
[testenv:docs]
sitepackages = {[docsbase]sitepackages}
changedir = {[docsbase]changedir}
install_command = {[docsbase]install_command}
deps = {[docsbase]deps}
2016-04-07 18:11:32 +00:00
whitelist_externals = {[docsbase]whitelist_externals}
commands = sphinx-build -v -E -T -b html -d build/doctrees source build/html
2014-09-25 21:12:00 +00:00
[testenv:docscoverage]
sitepackages = {[docsbase]sitepackages}
changedir = {[docsbase]changedir}
install_command = {[docsbase]install_command}
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
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'