deluge/tox.ini

200 lines
4.7 KiB
INI

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