style: Enable flake8 with proper exclusions
This patch ensures we are running flake8 in a DRY fashion, using the same exclusions as used for pep8. Also fixed is the pep8 module version mismatch between the version required for hacking.py and the newer version used by flake8. Finally, the doctest run for pep8 was removed, and enabled for nose instead. Implements: blueprint grizzly-debt Change-Id: I8e19512df4cd37f7ad637b66dff0a5982d14482c
This commit is contained in:
parent
221e934c71
commit
e5cc92939a
15
setup.cfg
15
setup.cfg
@ -1,10 +1,14 @@
|
||||
[nosetests]
|
||||
cover-package=marconi
|
||||
cover-html=true
|
||||
cover-erase=true
|
||||
cover-inclusive=true
|
||||
where=marconi/tests
|
||||
verbosity=2
|
||||
|
||||
with-doctest = true
|
||||
|
||||
cover-package = marconi
|
||||
cover-html = true
|
||||
cover-erase = true
|
||||
cover-inclusive = true
|
||||
|
||||
; Disabled: Causes a bug in testtools to manifest.
|
||||
; Trigger: self.assertX(condition), where condition == False.
|
||||
;
|
||||
@ -12,6 +16,5 @@ verbosity=2
|
||||
; None in _details_to_exc_info(), but the inspect_traceback()
|
||||
; method in nose/inspector.py requires a traceback-like object.
|
||||
;
|
||||
; detailed-errors=1
|
||||
; detailed-errors = 1
|
||||
|
||||
where=marconi/tests
|
||||
|
@ -1,15 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
# This is used by run_tests.sh and tox.ini
|
||||
python tools/hacking.py --doctest
|
||||
|
||||
# Until all these issues get fixed, ignore.
|
||||
PEP8='python tools/hacking.py --ignore=N404'
|
||||
FLAKE8='flake8 --builtins=_,__MARCONI_SETUP__'
|
||||
|
||||
EXCLUDE='--exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*'
|
||||
EXCLUDE+=',./tools'
|
||||
EXCLUDE+=',*egg,build'
|
||||
${PEP8} ${EXCLUDE} .
|
||||
|
||||
! flake8 marconi --builtins=_,__MARCONI_SETUP__
|
||||
if [ $1 = pep8 ]
|
||||
then
|
||||
${PEP8} ${EXCLUDE} .
|
||||
else
|
||||
${FLAKE8} ${EXCLUDE}
|
||||
fi
|
@ -3,8 +3,6 @@ coverage
|
||||
discover
|
||||
fixtures
|
||||
mox
|
||||
pep8==1.3.3
|
||||
flake8
|
||||
python-subunit
|
||||
testrepository
|
||||
testtools
|
||||
|
10
tox.ini
10
tox.ini
@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = py26,py27,pep8
|
||||
envlist = py26,py27,pep8,flake8
|
||||
|
||||
[testenv]
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
@ -18,8 +18,12 @@ sitepackages = True
|
||||
downloadcache = ~/cache/pip
|
||||
|
||||
[testenv:pep8]
|
||||
# deps = pep8==1.3.3
|
||||
commands = {toxinidir}/tools/run_pep8.sh
|
||||
deps = pep8==1.3.3
|
||||
commands = {toxinidir}/tools/run_pep8.sh pep8
|
||||
|
||||
[testenv:flake8]
|
||||
deps = flake8
|
||||
commands = {toxinidir}/tools/run_pep8.sh flake8
|
||||
|
||||
[testenv:cover]
|
||||
setenv = NOSE_WITH_COVERAGE=1
|
||||
|
Loading…
Reference in New Issue
Block a user