208 lines
5.0 KiB
INI
208 lines
5.0 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.
|
|
|
|
[flake8]
|
|
max-line-length = 120
|
|
builtins = _,__request__
|
|
exclude = .git,dist,build
|
|
|
|
[pep8]
|
|
max-line-length = 120
|
|
ignore = E301,E309
|
|
|
|
[tox]
|
|
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
|
|
slimit
|
|
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 --basetemp=_pytest_temp deluge
|
|
|
|
|
|
##############
|
|
# Unit tests
|
|
##############
|
|
|
|
[testenv:pydef]
|
|
commands =
|
|
python -c "import libtorrent as lt; print lt.version"
|
|
py.test -v --basetemp=_pytest_temp -s -m "not (todo or gtkui)" deluge/tests
|
|
|
|
[testenv:pygtkui]
|
|
commands = py.test -v --basetemp=_pytest_temp -s -m "gtkui" deluge/tests
|
|
|
|
[testenv:todo]
|
|
commands = py.test -v --basetemp=_pytest_temp -s -m "todo" deluge/tests
|
|
|
|
[testenv:trial]
|
|
setenv = {[testenv]setenv}:{env:PWD}/deluge/tests
|
|
whitelist_externals = trial
|
|
commands = trial --reporter=deluge-reporter deluge/tests
|
|
|
|
[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 --basetemp=_pytest_temp -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 --basetemp=_pytest_temp -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}
|
|
isort>=4.2.5
|
|
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]
|
|
# Disble site packages to avoid using system flake8 which uses hardcoded python path which imports the wrong libraries.
|
|
sitepackages = False
|
|
deps =
|
|
{[testenv]deps}
|
|
flake8
|
|
pep8-naming
|
|
commands =
|
|
flake8 --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
|
|
deps =
|
|
{[testenv]deps}
|
|
pylint
|
|
# Use bash to enable use of wildcard paths with pylint.
|
|
whitelist_externals = bash
|
|
commands =
|
|
pylint --version
|
|
pylint deluge
|
|
bash -c 'pylint *.py deluge/scripts/*.py'
|
|
bash -c 'pylint deluge/plugins/*/deluge/'
|
|
|
|
|
|
######################
|
|
# Unit Test coverage
|
|
######################
|
|
|
|
[testcoveragebase]
|
|
deps =
|
|
{[testenv]deps}
|
|
pytest-cov
|
|
coverage
|
|
whitelist_externals =
|
|
{[testenv]whitelist_externals}
|
|
coverage
|
|
commands = coverage run --branch --source=deluge -m py.test -m "not todo" deluge/tests/
|
|
|
|
[testenv:testcoverage]
|
|
setenv = {[testenv]setenv}
|
|
deps = {[testcoveragebase]deps}
|
|
whitelist_externals = {[testcoveragebase]whitelist_externals}
|
|
commands =
|
|
{[testcoveragebase]commands}
|
|
coverage report
|
|
|
|
[testenv:testcoverage-html]
|
|
setenv = {[testenv]setenv}
|
|
deps = {[testcoveragebase]deps}
|
|
whitelist_externals = {[testcoveragebase]whitelist_externals}
|
|
commands =
|
|
{[testcoveragebase]commands}
|
|
coverage html -d docs/build/htmlcoverage
|
|
|
|
|
|
######################
|
|
# Docs generation
|
|
######################
|
|
|
|
# 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 =
|
|
{[testenv]deps}
|
|
sphinx
|
|
sphinxcontrib-napoleon
|
|
pillow
|
|
whitelist_externals =
|
|
{[testenv]whitelist_externals}
|
|
sphinx-build
|
|
|
|
[testenv:docs]
|
|
sitepackages = {[docsbase]sitepackages}
|
|
deps = {[docsbase]deps}
|
|
whitelist_externals = echo
|
|
commands =
|
|
echo "sphinx-apidoc --force -o docs/source/modules/ deluge deluge/plugins"
|
|
echo "sphinx-build -v -E -T -b html -d docs/build/doctrees docs/source docs/build/html"
|
|
python setup.py build_docs
|
|
|
|
[testenv:docscoverage]
|
|
sitepackages = {[docsbase]sitepackages}
|
|
changedir = {[docsbase]changedir}
|
|
deps =
|
|
{[docsbase]deps}
|
|
coverage
|
|
pytest-cov
|
|
whitelist_externals =
|
|
{[docsbase]whitelist_externals}
|
|
mkdir
|
|
commands =
|
|
mkdir -p build/doccoverage
|
|
sphinx-build -W -b coverage -d build/doctrees source build/doccoverage
|
|
py.test --doctest-glob='*.rst'
|