summaryrefslogtreecommitdiffstats
path: root/tox.ini
diff options
context:
space:
mode:
Diffstat (limited to 'tox.ini')
-rw-r--r--tox.ini165
1 files changed, 165 insertions, 0 deletions
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..3756a54
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,165 @@
+# 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 = py3, lint, docs
+minversion=3.0
+
+# =================
+# Base dependencies
+# =================
+[basesetup]
+# Minimum pip and setuptools versions to fix system and travis issues.
+deps =
+ pip >= 10
+ setuptools >= 40
+
+[basetests]
+deps =
+ {[basesetup]deps}
+ -rrequirements.txt
+ -rrequirements-tests.txt
+
+[baselint]
+deps =
+ {[basesetup]deps}
+ -rrequirements-tests.txt
+
+[basedev]
+deps =
+ {[basesetup]deps}
+ -rrequirements.txt
+ -rrequirements-dev.txt
+ -rrequirements-tests.txt
+
+[basedocs]
+deps =
+ {[basesetup]deps}
+ -rdocs/requirements.txt
+
+# ======================
+# Test environment setup
+# ======================
+
+[testenv]
+install_command = python -m pip install --ignore-installed {opts} {packages}
+passenv = DISPLAY,PYTHONPATH,APPDATA
+setenv =
+ PYTHONPATH = {toxinidir}
+ PYTEST_ADDOPTS = --verbose --capture=no
+sitepackages = True
+deps = {[basetests]deps}
+commands =
+ python -VV
+ python -c "import libtorrent as lt; print(lt.__version__)"
+ pytest -m "not (todo or gtkui or security)" deluge/tests
+
+# ==========
+# Unit tests
+# ==========
+
+[testenv:security]
+setenv = SECURITY_TESTS = True
+commands = pytest -m "security" deluge/tests
+
+[testenv:gtkui]
+commands = pytest -m "gtkui" deluge/tests
+
+[testenv:todo]
+commands = pytest -m "todo" deluge/tests
+
+[testenv:plugins]
+setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins
+commands =
+ python setup.py build_plugins --develop --install-dir={toxinidir}/deluge/plugins/
+ pytest -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 deluge/plugins
+
+# ============
+# Code linting
+# ============
+
+# Disable site-packages to avoid using system installed commands.
+
+[testenv:lint]
+sitepackages = False
+passenv = HOMEPATH,SSH_AUTH_SOCK
+deps = {[baselint]deps}
+commands = pre-commit run --all-files
+
+[testenv:flake8]
+sitepackages = False
+deps = {[baselint]deps}
+commands =
+ flake8 --version
+ python -c 'import isort; print(isort.__version__)'
+ flake8 *.py deluge
+
+[testenv:flake8-complexity]
+sitepackages = False
+deps = {[baselint]deps}
+commands = flake8 --exit-zero --max-complexity 15 deluge
+
+[testenv:pylint]
+sitepackages = False
+ignore_errors = True
+deps = {[baselint]deps}
+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/
+
+# ========
+# Coverage
+# ========
+
+[coveragebase]
+commands = coverage run --branch --source=deluge -m pytest -m "not todo" deluge/tests
+
+[testenv:coverage]
+commands =
+ {[coveragebase]commands}
+ coverage html -d docs/build/htmlcoverage
+ coverage report
+
+# ===================
+# Documentation build
+# ===================
+
+[testenv:docs]
+# Exclude site-packages so local builds have a similar environment to ReadTheDocs.
+sitepackages = False
+deps = {[basedocs]deps}
+commands =
+ python setup.py clean_docs
+ 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
+
+[testenv:docscoverage]
+sitepackages = False
+deps =
+ {[basedocs]deps}
+ pytest-cov
+commands =
+ sphinx-build -b coverage -d docs/build/doctrees docs/source docs/build/doccoverage
+ pytest --doctest-glob='*.rst'
+
+# ========================
+# Development Environment
+# ========================
+
+[testenv:denv]
+basepython = python3
+envdir = .venv
+usedevelop = True
+deps = {[basedev]deps}
+commands =