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
|
|
|
|
|
|
|
[tox]
|
2021-12-25 12:34:49 +00:00
|
|
|
envlist = py3, lint, docs
|
2018-10-25 14:02:53 +00:00
|
|
|
minversion=3.0
|
2014-09-21 14:37:29 +00:00
|
|
|
|
2018-10-25 14:02:53 +00:00
|
|
|
# =================
|
|
|
|
# Base dependencies
|
|
|
|
# =================
|
|
|
|
[basesetup]
|
|
|
|
# Minimum pip and setuptools versions to fix system and travis issues.
|
2018-10-08 15:05:40 +00:00
|
|
|
deps =
|
2020-04-11 17:56:46 +00:00
|
|
|
pip >= 10
|
2019-04-26 08:55:02 +00:00
|
|
|
setuptools >= 40
|
2018-10-25 14:02:53 +00:00
|
|
|
|
|
|
|
[basetests]
|
|
|
|
deps =
|
|
|
|
{[basesetup]deps}
|
|
|
|
-rrequirements.txt
|
|
|
|
-rrequirements-tests.txt
|
|
|
|
|
|
|
|
[baselint]
|
|
|
|
deps =
|
|
|
|
{[basesetup]deps}
|
|
|
|
-rrequirements-tests.txt
|
|
|
|
|
|
|
|
[basedev]
|
|
|
|
deps =
|
|
|
|
{[basesetup]deps}
|
2018-10-08 15:05:40 +00:00
|
|
|
-rrequirements.txt
|
2018-10-25 14:02:53 +00:00
|
|
|
-rrequirements-dev.txt
|
|
|
|
-rrequirements-tests.txt
|
|
|
|
|
|
|
|
[basedocs]
|
|
|
|
deps =
|
|
|
|
{[basesetup]deps}
|
2019-05-21 01:19:57 +00:00
|
|
|
-rdocs/requirements.txt
|
2018-10-25 14:02:53 +00:00
|
|
|
|
|
|
|
# ======================
|
|
|
|
# Test environment setup
|
|
|
|
# ======================
|
2018-10-03 15:12:29 +00:00
|
|
|
|
2014-09-21 14:37:29 +00:00
|
|
|
[testenv]
|
2018-10-25 14:02:53 +00:00
|
|
|
install_command = python -m pip install --ignore-installed {opts} {packages}
|
2023-01-23 00:30:13 +00:00
|
|
|
passenv = DISPLAY,PYTHONPATH,APPDATA
|
2018-10-25 14:02:53 +00:00
|
|
|
setenv =
|
|
|
|
PYTHONPATH = {toxinidir}
|
2020-04-11 17:56:46 +00:00
|
|
|
PYTEST_ADDOPTS = --verbose --capture=no
|
2014-09-25 20:56:15 +00:00
|
|
|
sitepackages = True
|
2018-10-25 14:02:53 +00:00
|
|
|
deps = {[basetests]deps}
|
2018-10-10 13:49:39 +00:00
|
|
|
commands =
|
2019-05-22 17:23:30 +00:00
|
|
|
python -VV
|
2018-10-10 13:49:39 +00:00
|
|
|
python -c "import libtorrent as lt; print(lt.__version__)"
|
2018-10-25 14:02:53 +00:00
|
|
|
pytest -m "not (todo or gtkui or security)" deluge/tests
|
2018-10-03 15:12:29 +00:00
|
|
|
|
|
|
|
# ==========
|
2014-10-03 22:14:20 +00:00
|
|
|
# Unit tests
|
2018-10-03 15:12:29 +00:00
|
|
|
# ==========
|
2014-09-21 14:37:29 +00:00
|
|
|
|
2018-06-24 17:39:04 +00:00
|
|
|
[testenv:security]
|
|
|
|
setenv = SECURITY_TESTS = True
|
2018-10-25 14:02:53 +00:00
|
|
|
commands = pytest -m "security" deluge/tests
|
2014-10-13 14:38:51 +00:00
|
|
|
|
2018-10-25 14:02:53 +00:00
|
|
|
[testenv:gtkui]
|
|
|
|
commands = pytest -m "gtkui" deluge/tests
|
2014-10-13 14:38:51 +00:00
|
|
|
|
|
|
|
[testenv:todo]
|
2018-10-25 14:02:53 +00:00
|
|
|
commands = pytest -m "todo" deluge/tests
|
2014-10-13 14:38:51 +00:00
|
|
|
|
2014-09-25 13:25:03 +00:00
|
|
|
[testenv:plugins]
|
2018-05-20 23:21:20 +00:00
|
|
|
setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins
|
2016-04-13 19:38:33 +00:00
|
|
|
commands =
|
2018-05-19 20:51:24 +00:00
|
|
|
python setup.py build_plugins --develop --install-dir={toxinidir}/deluge/plugins/
|
2018-10-25 14:02:53 +00:00
|
|
|
pytest -m "not gtkui" deluge/plugins
|
2016-04-19 14:18:51 +00:00
|
|
|
|
|
|
|
[testenv:pluginsgtkui]
|
2018-05-20 23:21:20 +00:00
|
|
|
setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins
|
2016-04-19 14:18:51 +00:00
|
|
|
commands =
|
2018-05-19 20:51:24 +00:00
|
|
|
python setup.py build_plugins --develop --install-dir={toxinidir}/deluge/plugins/
|
2018-10-25 14:02:53 +00:00
|
|
|
pytest deluge/plugins
|
2014-10-03 22:14:20 +00:00
|
|
|
|
2018-10-25 14:02:53 +00:00
|
|
|
# ============
|
2018-10-03 15:12:29 +00:00
|
|
|
# Code linting
|
2018-10-25 14:02:53 +00:00
|
|
|
# ============
|
|
|
|
|
|
|
|
# Disable site-packages to avoid using system installed commands.
|
2014-10-03 22:14:20 +00:00
|
|
|
|
2018-10-05 14:33:26 +00:00
|
|
|
[testenv:lint]
|
2018-10-25 14:02:53 +00:00
|
|
|
sitepackages = False
|
2023-01-23 00:30:13 +00:00
|
|
|
passenv = HOMEPATH,SSH_AUTH_SOCK
|
2018-10-25 14:02:53 +00:00
|
|
|
deps = {[baselint]deps}
|
|
|
|
commands = pre-commit run --all-files
|
2018-10-05 14:33:26 +00:00
|
|
|
|
2014-09-21 14:37:29 +00:00
|
|
|
[testenv:flake8]
|
2016-05-21 17:53:40 +00:00
|
|
|
sitepackages = False
|
2018-10-25 14:02:53 +00:00
|
|
|
deps = {[baselint]deps}
|
2016-01-14 20:18:12 +00:00
|
|
|
commands =
|
|
|
|
flake8 --version
|
2016-11-25 11:46:36 +00:00
|
|
|
python -c 'import isort; print(isort.__version__)'
|
2018-10-25 14:02:53 +00:00
|
|
|
flake8 *.py deluge
|
2014-09-21 14:37:29 +00:00
|
|
|
|
|
|
|
[testenv:flake8-complexity]
|
2016-05-21 17:53:40 +00:00
|
|
|
sitepackages = False
|
2018-10-25 14:02:53 +00:00
|
|
|
deps = {[baselint]deps}
|
2014-09-25 21:58:00 +00:00
|
|
|
commands = flake8 --exit-zero --max-complexity 15 deluge
|
2014-09-21 14:37:29 +00:00
|
|
|
|
2016-04-19 17:06:55 +00:00
|
|
|
[testenv:pylint]
|
2016-05-21 17:53:40 +00:00
|
|
|
sitepackages = False
|
2016-11-02 08:12:55 +00:00
|
|
|
ignore_errors = True
|
2018-10-25 14:02:53 +00:00
|
|
|
deps = {[baselint]deps}
|
2016-04-19 17:06:55 +00:00
|
|
|
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 17:06:55 +00:00
|
|
|
|
2018-10-25 14:02:53 +00:00
|
|
|
# ========
|
|
|
|
# Coverage
|
|
|
|
# ========
|
2016-04-19 17:06:55 +00:00
|
|
|
|
2018-10-25 14:02:53 +00:00
|
|
|
[coveragebase]
|
|
|
|
commands = coverage run --branch --source=deluge -m pytest -m "not todo" deluge/tests
|
2014-10-03 22:14:20 +00:00
|
|
|
|
2018-10-25 14:02:53 +00:00
|
|
|
[testenv:coverage]
|
2014-10-03 22:14:20 +00:00
|
|
|
commands =
|
2018-10-25 14:02:53 +00:00
|
|
|
{[coveragebase]commands}
|
2014-10-03 22:14:20 +00:00
|
|
|
coverage html -d docs/build/htmlcoverage
|
2018-10-25 14:02:53 +00:00
|
|
|
coverage report
|
2014-10-03 22:14:20 +00:00
|
|
|
|
2018-10-03 15:12:29 +00:00
|
|
|
# ===================
|
|
|
|
# Documentation build
|
|
|
|
# ===================
|
2014-10-03 22:14:20 +00:00
|
|
|
|
2014-09-25 21:12:00 +00:00
|
|
|
[testenv:docs]
|
2018-10-25 14:02:53 +00:00
|
|
|
# Exclude site-packages so local builds have a similar environment to ReadTheDocs.
|
|
|
|
sitepackages = False
|
|
|
|
deps = {[basedocs]deps}
|
2016-05-21 17:53:40 +00:00
|
|
|
commands =
|
2016-11-27 17:04:12 +00:00
|
|
|
python setup.py clean_docs
|
2019-06-15 18:44:33 +00:00
|
|
|
sphinx-build -v -j auto -E -b html -d docs/build/doctrees docs/source docs/build/html
|
|
|
|
sphinx-build -v -j auto -b spelling -d docs/build/doctrees docs/source docs/build/spelling
|
2014-09-25 21:12:00 +00:00
|
|
|
|
|
|
|
[testenv:docscoverage]
|
2018-10-25 14:02:53 +00:00
|
|
|
sitepackages = False
|
2014-09-25 20:56:15 +00:00
|
|
|
deps =
|
2018-10-25 14:02:53 +00:00
|
|
|
{[basedocs]deps}
|
2014-09-25 21:12:00 +00:00
|
|
|
pytest-cov
|
2014-09-25 20:56:15 +00:00
|
|
|
commands =
|
2019-06-05 22:32:37 +00:00
|
|
|
sphinx-build -b coverage -d docs/build/doctrees docs/source docs/build/doccoverage
|
2017-12-17 10:55:44 +00:00
|
|
|
pytest --doctest-glob='*.rst'
|
2018-10-03 15:12:29 +00:00
|
|
|
|
|
|
|
# ========================
|
2018-10-05 08:33:26 +00:00
|
|
|
# Development Environment
|
2018-10-03 15:12:29 +00:00
|
|
|
# ========================
|
2018-10-08 15:05:40 +00:00
|
|
|
|
2019-06-05 18:25:53 +00:00
|
|
|
[testenv:denv]
|
2018-10-08 15:05:40 +00:00
|
|
|
basepython = python3
|
2019-06-05 18:25:53 +00:00
|
|
|
envdir = .venv
|
2018-10-25 14:02:53 +00:00
|
|
|
usedevelop = True
|
2018-10-08 15:05:40 +00:00
|
|
|
deps = {[basedev]deps}
|
2018-10-10 13:49:39 +00:00
|
|
|
commands =
|