From e5cc92939a6406ea938bd24ccaabe1e0128c05b3 Mon Sep 17 00:00:00 2001 From: kgriffs Date: Fri, 3 May 2013 17:35:06 -0400 Subject: [PATCH] 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 --- setup.cfg | 15 +++++++++------ tools/run_pep8.sh | 12 +++++++----- tools/test-requires | 2 -- tox.ini | 10 +++++++--- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/setup.cfg b/setup.cfg index 4e3c6b40c..64ee6708a 100644 --- a/setup.cfg +++ b/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 diff --git a/tools/run_pep8.sh b/tools/run_pep8.sh index 2c88ac03f..901f432a6 100755 --- a/tools/run_pep8.sh +++ b/tools/run_pep8.sh @@ -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 \ No newline at end of file diff --git a/tools/test-requires b/tools/test-requires index 85822399c..46f73590f 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -3,8 +3,6 @@ coverage discover fixtures mox -pep8==1.3.3 -flake8 python-subunit testrepository testtools diff --git a/tox.ini b/tox.ini index 44cf61a61..ec10b5b7e 100644 --- a/tox.ini +++ b/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