Refactor/cleanup of tox.ini

* Removed unused mock dep
 * Modified flake8 to run entire codebase (fixed exclude)
 * Change isort to shows files that need attention (no diff)
 * Uniform layout for tox.ini
 * Change flake8 complexity to 15
This commit is contained in:
Calum Lind 2014-09-25 21:56:15 +01:00
parent bb9702910b
commit 23ab85e253
2 changed files with 43 additions and 60 deletions

View File

@ -1,7 +1,6 @@
twisted
pyopenssl
sphinxcontrib-napoleon
mock
pyxdg
service_identity
PIL

102
tox.ini
View File

@ -6,15 +6,14 @@
[flake8]
max-line-length = 120
builtins = _,__request__
exclude = .tox, .git, dist, build
ignore = E123,E133,E226,E241,E242
exclude = .tox,.git,dist,build
[tox]
envlist = py27, py26, flake8, isort, docs
[testenv]
commands = {envpython} setup.py test
sitepackages=True
setenv = PYTHONPATH = {env:PYTHONPATH}:{env:PWD}
sitepackages = True
deps =
twisted
service_identity
@ -23,131 +22,116 @@ deps =
pyopenssl
pyxdg
pytest
whitelist_externals=
py.test
setenv =
PYTHONPATH = {env:PYTHONPATH}:{env:PWD}
whitelist_externals = py.test
commands = {envpython} setup.py test
[pytest]
python_functions=test_
norecursedirs=.tox .git dist build
python_functions = test_
norecursedirs = .tox .git dist build
pep8maxlinelength = 120
whitelist_externals=
{[testenv]whitelist_externals}
commands=
py.test deluge
whitelist_externals= {[testenv]whitelist_externals}
commands = py.test deluge
[testenv:testcoverage]
install_command=pip install {opts} {packages}
install_command = pip install {opts} {packages}
deps =
{[testenv]deps}
pytest-cov
coverage
whitelist_externals=
whitelist_externals =
{[testenv]whitelist_externals}
coverage
commands=
commands =
coverage run --branch --source=deluge -m py.test deluge/tests/
coverage report
# For creating html report
# coverage html -d docs/build/htmlcoverage
[testenv:pydef]
commands=
commands =
python -c "import libtorrent as lt; print lt.version"
py.test deluge/tests
[testenv:plugins]
commands=
py.test deluge/plugins
commands = py.test deluge/plugins
[testenv:py26]
basepython=python2.6
commands=
{[testenv:pydef]commands}
basepython = python2.6
commands = {[testenv:pydef]commands}
[testenv:py27]
basepython=python2.7
commands=
{[testenv:pydef]commands}
basepython = python2.7
commands = {[testenv:pydef]commands}
[testenv:isort]
deps =
{[testenv]deps}
isort
whitelist_externals=
whitelist_externals =
{[testenv]whitelist_externals}
isort
commands=
python -c "import subprocess, sys; output = subprocess.check_output('isort --recursive --diff --stdout deluge docs/ *.py', shell=True); print output; sys.exit(len(output) != 0)"
commands = isort --recursive --check-only deluge docs win32 *.py
[testenv:flake8]
setenv =
{[testenv]setenv}
whitelist_externals=
setenv = {[testenv]setenv}
whitelist_externals =
{[testenv]whitelist_externals}
flake8
deps =
{[testenv]deps}
flake8
pep8-naming
commands=
flake8 deluge
commands = flake8
[testenv:flake8-complexity]
setenv =
{[testenv]setenv}
whitelist_externals=
setenv = {[testenv]setenv}
whitelist_externals =
{[testenv]whitelist_externals}
flake8
sh
deps =
{[testenv:flake8]deps}
mccabe
commands=
sh -c "flake8 --max-complexity 10 deluge || true"
commands = flake8 --max-complexity --exit-zero 15 deluge
# 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
install_command=pip install {opts} --allow-external PIL --allow-unverified PIL {packages}
whitelist_externals=
sitepackages = False
changedir = docs
install_command = pip install {opts} --allow-external PIL --allow-unverified PIL {packages}
whitelist_externals =
{[testenv]whitelist_externals}
sphinx-build
deps =
{[testenv]deps}
sphinx
sphinxcontrib-napoleon
mock
PIL
commands=
sphinx-build -E -W -b html -d build/doctrees source build/html
commands = sphinx-build -E -W -b html -d build/doctrees source build/html
[testenv:docs]
sitepackages={[docsbase]sitepackages}
changedir={[docsbase]changedir}
install_command={[docsbase]install_command}
whitelist_externals={[docsbase]whitelist_externals}
deps={[docsbase]deps}
commands=
sphinx-build -v -E -T -b html -d build/doctrees source build/html
sitepackages = {[docsbase]sitepackages}
changedir = {[docsbase]changedir}
install_command = {[docsbase]install_command}
whitelist_externals = {[docsbase]whitelist_externals}
deps = {[docsbase]deps}
commands = sphinx-build -v -E -T -b html -d build/doctrees source build/html
[testenv:docscoverage]
sitepackages={[docsbase]sitepackages}
changedir={[docsbase]changedir}
install_command={[docsbase]install_command}
whitelist_externals=
sitepackages = {[docsbase]sitepackages}
changedir = {[docsbase]changedir}
install_command = {[docsbase]install_command}
whitelist_externals =
{[docsbase]whitelist_externals}
mkdir
deps=
deps =
{[docsbase]deps}
coverage
pytest-cov
commands=
commands =
mkdir -p build/doccoverage
sphinx-build -W -b coverage -d build/doctrees source build/doccoverage
py.test --doctest-glob='*.rst'