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 twisted
pyopenssl pyopenssl
sphinxcontrib-napoleon sphinxcontrib-napoleon
mock
pyxdg pyxdg
service_identity service_identity
PIL PIL

102
tox.ini
View File

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