2016-04-07 19:11:32 +01: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 16:37:29 +02:00
|
|
|
|
|
|
|
[tox]
|
2018-10-10 14:49:39 +01:00
|
|
|
envlist = py27, py3, lint, docs
|
2018-05-20 19:21:20 -04:00
|
|
|
minversion=2.0
|
2014-09-21 16:37:29 +02:00
|
|
|
|
2018-10-03 16:12:29 +01:00
|
|
|
[base]
|
2018-10-08 16:05:40 +01:00
|
|
|
deps =
|
|
|
|
# Minimum pip version and setuptools to fix issue running on travis.
|
|
|
|
pip>=10
|
|
|
|
setuptools
|
|
|
|
-rrequirements.txt
|
2018-10-03 16:12:29 +01:00
|
|
|
|
2014-09-21 16:37:29 +02:00
|
|
|
[testenv]
|
2018-10-08 16:05:40 +01:00
|
|
|
install_command = {envpython} -m pip install --ignore-installed {opts} {packages}
|
2017-12-16 17:32:01 +00:00
|
|
|
passenv = DISPLAY PYTHONPATH
|
2018-05-20 19:21:20 -04:00
|
|
|
setenv = PYTHONPATH = {toxinidir}
|
2014-09-25 21:56:15 +01:00
|
|
|
sitepackages = True
|
2014-09-21 16:37:29 +02:00
|
|
|
deps =
|
2018-10-03 16:12:29 +01:00
|
|
|
{[base]deps}
|
|
|
|
-rrequirements-tests.txt
|
2018-10-10 14:49:39 +01:00
|
|
|
commands =
|
|
|
|
python -c "import libtorrent as lt; print(lt.__version__)"
|
|
|
|
pytest -v -s -m "not (todo or gtkui or security)" deluge/tests
|
2014-09-21 16:37:29 +02:00
|
|
|
|
|
|
|
[pytest]
|
2017-12-17 10:55:44 +00:00
|
|
|
# Hide logged warnings and errors in test output.
|
|
|
|
log_cli_level = CRITICAL
|
2018-10-10 14:49:39 +01:00
|
|
|
addopts = -p no:warnings --basetemp=_pytest_temp
|
2018-10-03 16:12:29 +01:00
|
|
|
|
|
|
|
# ==========
|
2014-10-04 00:14:20 +02:00
|
|
|
# Unit tests
|
2018-10-03 16:12:29 +01:00
|
|
|
# ==========
|
2014-09-21 16:37:29 +02:00
|
|
|
|
2018-06-24 20:39:04 +03:00
|
|
|
[testenv:security]
|
|
|
|
setenv = SECURITY_TESTS = True
|
2018-10-10 14:49:39 +01:00
|
|
|
commands = pytest -v -s -m "security" deluge/tests/
|
2014-10-13 16:38:51 +02:00
|
|
|
|
|
|
|
[testenv:pygtkui]
|
2018-10-10 14:49:39 +01:00
|
|
|
commands = pytest -v -s -m "gtkui" deluge/tests
|
2014-10-13 16:38:51 +02:00
|
|
|
|
|
|
|
[testenv:todo]
|
2018-10-10 14:49:39 +01:00
|
|
|
commands = pytest -v -s -m "todo" deluge/tests
|
2014-10-13 16:38:51 +02:00
|
|
|
|
|
|
|
[testenv:trial]
|
2018-05-20 19:21:20 -04:00
|
|
|
setenv = {[testenv]setenv}{:}{toxinidir}/deluge/tests
|
2016-12-01 23:15:06 +00:00
|
|
|
commands =
|
2018-10-10 14:49:39 +01:00
|
|
|
python -c "import libtorrent as lt; print(lt.__version__)"
|
2017-12-16 17:32:01 +00:00
|
|
|
python -m twisted.trial --reporter=deluge-reporter deluge.tests
|
2014-09-21 16:37:29 +02:00
|
|
|
|
2014-09-25 14:25:03 +01:00
|
|
|
[testenv:plugins]
|
2018-05-20 19:21:20 -04:00
|
|
|
setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins
|
2016-04-13 21:38:33 +02:00
|
|
|
commands =
|
2018-05-19 21:51:24 +01:00
|
|
|
python setup.py build_plugins --develop --install-dir={toxinidir}/deluge/plugins/
|
2018-10-10 14:49:39 +01:00
|
|
|
pytest -v -s -m "not gtkui" deluge/plugins
|
2016-04-19 16:18:51 +02:00
|
|
|
|
|
|
|
[testenv:pluginsgtkui]
|
2018-05-20 19:21:20 -04:00
|
|
|
setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins
|
2016-04-19 16:18:51 +02:00
|
|
|
commands =
|
2018-05-19 21:51:24 +01:00
|
|
|
python setup.py build_plugins --develop --install-dir={toxinidir}/deluge/plugins/
|
2018-10-10 14:49:39 +01:00
|
|
|
pytest -v -s deluge/plugins
|
2014-10-04 00:14:20 +02:00
|
|
|
|
2018-10-03 16:12:29 +01:00
|
|
|
|
|
|
|
# =======================
|
|
|
|
# Code linting
|
|
|
|
# =======================
|
2014-10-04 00:14:20 +02:00
|
|
|
|
2018-10-05 15:33:26 +01:00
|
|
|
[testenv:lint]
|
|
|
|
passenv = HOMEPATH SSH_AUTH_SOCK
|
|
|
|
deps =
|
|
|
|
pre-commit
|
|
|
|
commands =
|
|
|
|
pre-commit run --all-files
|
|
|
|
|
2014-09-21 16:37:29 +02:00
|
|
|
[testenv:flake8]
|
2018-10-03 16:12:29 +01:00
|
|
|
# Disable site packages to avoid using system flake8 which uses
|
|
|
|
# hardcoded python path which imports the wrong libraries.
|
2016-05-21 19:53:40 +02:00
|
|
|
sitepackages = False
|
2014-09-21 16:37:29 +02:00
|
|
|
deps =
|
|
|
|
{[testenv]deps}
|
|
|
|
flake8
|
2016-11-03 22:37:00 +00:00
|
|
|
flake8-quotes
|
2016-11-25 11:46:36 +00:00
|
|
|
flake8-isort
|
2014-09-21 16:37:29 +02:00
|
|
|
pep8-naming
|
2016-01-14 21:18:12 +01:00
|
|
|
commands =
|
|
|
|
flake8 --version
|
2016-11-25 11:46:36 +00:00
|
|
|
python -c 'import isort; print(isort.__version__)'
|
2016-01-14 21:18:12 +01:00
|
|
|
flake8
|
2014-09-21 16:37:29 +02:00
|
|
|
|
|
|
|
[testenv:flake8-complexity]
|
2016-05-21 19:53:40 +02:00
|
|
|
sitepackages = False
|
2014-09-21 16:37:29 +02:00
|
|
|
deps =
|
|
|
|
{[testenv:flake8]deps}
|
|
|
|
mccabe
|
2014-09-25 22:58:00 +01:00
|
|
|
commands = flake8 --exit-zero --max-complexity 15 deluge
|
2014-09-21 16:37:29 +02:00
|
|
|
|
2014-10-04 00:14:20 +02:00
|
|
|
|
2016-04-19 19:06:55 +02:00
|
|
|
[testenv:pylint]
|
2016-05-21 19:53:40 +02:00
|
|
|
# Disable site packages to avoid using system installed version
|
|
|
|
sitepackages = False
|
2016-11-02 09:12:55 +01:00
|
|
|
ignore_errors = True
|
2016-04-19 19:06:55 +02:00
|
|
|
deps =
|
|
|
|
{[testenv]deps}
|
|
|
|
pylint
|
|
|
|
commands =
|
|
|
|
pylint --version
|
|
|
|
pylint deluge
|
2017-12-17 10:55:44 +00:00
|
|
|
# Use python to enable use of wildcard paths with pylint.
|
|
|
|
python -m pylint *.py deluge/scripts/*.py
|
|
|
|
python -m pylint deluge/plugins/*/deluge/
|
2016-04-19 19:06:55 +02:00
|
|
|
|
|
|
|
|
2018-10-03 16:12:29 +01:00
|
|
|
# =============
|
|
|
|
# Test coverage
|
|
|
|
# =============
|
2014-10-04 00:14:20 +02:00
|
|
|
|
|
|
|
[testcoveragebase]
|
|
|
|
deps =
|
|
|
|
{[testenv]deps}
|
|
|
|
pytest-cov
|
|
|
|
coverage
|
2017-12-17 10:55:44 +00:00
|
|
|
commands = coverage run --branch --source=deluge -m pytest -m "not todo" deluge/tests/
|
2014-10-04 00:14:20 +02:00
|
|
|
|
|
|
|
[testenv:testcoverage]
|
|
|
|
setenv = {[testenv]setenv}
|
2016-04-07 19:11:32 +01:00
|
|
|
deps = {[testcoveragebase]deps}
|
2014-10-04 00:14:20 +02:00
|
|
|
commands =
|
|
|
|
{[testcoveragebase]commands}
|
|
|
|
coverage report
|
|
|
|
|
|
|
|
[testenv:testcoverage-html]
|
|
|
|
setenv = {[testenv]setenv}
|
2016-04-07 19:11:32 +01:00
|
|
|
deps = {[testcoveragebase]deps}
|
2014-10-04 00:14:20 +02:00
|
|
|
commands =
|
|
|
|
{[testcoveragebase]commands}
|
|
|
|
coverage html -d docs/build/htmlcoverage
|
|
|
|
|
|
|
|
|
2018-10-03 16:12:29 +01:00
|
|
|
# ===================
|
|
|
|
# Documentation build
|
|
|
|
# ===================
|
2014-10-04 00:14:20 +02:00
|
|
|
|
2014-09-25 22:12:00 +01: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 16:37:29 +02:00
|
|
|
|
2014-09-25 22:12:00 +01:00
|
|
|
[docsbase]
|
2014-09-25 21:56:15 +01:00
|
|
|
sitepackages = False
|
|
|
|
changedir = docs
|
2014-09-21 16:37:29 +02:00
|
|
|
deps =
|
2018-10-04 11:55:53 +01:00
|
|
|
-rrequirements-docs.txt
|
2014-09-25 22:12:00 +01:00
|
|
|
|
|
|
|
[testenv:docs]
|
2018-10-05 09:33:26 +01:00
|
|
|
basepython = python2.7
|
2014-09-25 21:56:15 +01:00
|
|
|
sitepackages = {[docsbase]sitepackages}
|
2018-11-01 23:18:05 +00:00
|
|
|
skip_install = True
|
2014-09-25 21:56:15 +01:00
|
|
|
deps = {[docsbase]deps}
|
2016-05-21 19:53:40 +02:00
|
|
|
commands =
|
2016-11-27 17:04:12 +00:00
|
|
|
python setup.py clean_docs
|
2018-07-28 08:14:25 +01:00
|
|
|
sphinx-build -v -j auto -E -T -b html -d docs/build/doctrees docs/source docs/build/html
|
2014-09-25 22:12:00 +01:00
|
|
|
|
|
|
|
[testenv:docscoverage]
|
2018-10-05 09:33:26 +01:00
|
|
|
basepython = python2.7
|
2014-09-25 21:56:15 +01:00
|
|
|
sitepackages = {[docsbase]sitepackages}
|
2018-11-01 23:18:05 +00:00
|
|
|
skip_install = True
|
2014-09-25 21:56:15 +01:00
|
|
|
changedir = {[docsbase]changedir}
|
|
|
|
deps =
|
2014-09-25 22:12:00 +01:00
|
|
|
{[docsbase]deps}
|
|
|
|
pytest-cov
|
2018-10-10 14:49:39 +01:00
|
|
|
whitelist_externals = mkdir
|
2014-09-25 21:56:15 +01:00
|
|
|
commands =
|
2014-09-25 22:12:00 +01:00
|
|
|
mkdir -p build/doccoverage
|
|
|
|
sphinx-build -W -b coverage -d build/doctrees source build/doccoverage
|
2017-12-17 10:55:44 +00:00
|
|
|
pytest --doctest-glob='*.rst'
|
2018-10-03 16:12:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
# ========================
|
2018-10-05 09:33:26 +01:00
|
|
|
# Development Environment
|
2018-10-03 16:12:29 +01:00
|
|
|
# ========================
|
2018-10-08 16:05:40 +01:00
|
|
|
[basedev]
|
2018-10-03 16:12:29 +01:00
|
|
|
usedevelop = True
|
|
|
|
deps = -rrequirements-dev.txt
|
2018-10-08 16:05:40 +01:00
|
|
|
|
|
|
|
[testenv:denv2]
|
|
|
|
basepython = python2.7
|
2018-10-10 14:49:39 +01:00
|
|
|
envdir = .venv2
|
2018-10-08 16:05:40 +01:00
|
|
|
usedevelop = {[basedev]usedevelop}
|
|
|
|
deps = {[basedev]deps}
|
2018-10-10 14:49:39 +01:00
|
|
|
commands =
|
2018-10-08 16:05:40 +01:00
|
|
|
|
|
|
|
[testenv:denv3]
|
|
|
|
basepython = python3
|
|
|
|
envdir = .venv3
|
|
|
|
usedevelop = {[basedev]usedevelop}
|
|
|
|
deps = {[basedev]deps}
|
2018-10-10 14:49:39 +01:00
|
|
|
commands =
|