From: Chuck Short Date: Tue, 20 Nov 2012 15:05:57 +0000 (-0600) Subject: Pin pep8 1.3.3 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ceee1fdaf2f54666ac72c6aa8076f92b6289327c;p=openstack-build%2Fcinder-build.git Pin pep8 1.3.3 Apart of making pep8 version standard across all openstack projects. Also fix tools/hacking.py so it is compliant for pep8 1.2 and beyond, taken from fbc4568 in the nova tree. Change-Id: I801c98a01960fa113dae1b6174c1a06bb149fea3 Signed-off-by: Chuck Short --- diff --git a/cinder/tests/api/openstack/volume/test_extensions.py b/cinder/tests/api/openstack/volume/test_extensions.py index 72749ce4c..e1e9748be 100644 --- a/cinder/tests/api/openstack/volume/test_extensions.py +++ b/cinder/tests/api/openstack/volume/test_extensions.py @@ -16,10 +16,9 @@ # License for the specific language governing permissions and limitations # under the License. - -import webob -from lxml import etree import iso8601 +from lxml import etree +import webob from cinder.api.openstack import volume from cinder.api.openstack import xmlutil diff --git a/cinder/tests/api/openstack/volume/test_router.py b/cinder/tests/api/openstack/volume/test_router.py index 6be12e14d..eba2388c0 100644 --- a/cinder/tests/api/openstack/volume/test_router.py +++ b/cinder/tests/api/openstack/volume/test_router.py @@ -16,8 +16,8 @@ from cinder.api.openstack import volume from cinder.api.openstack.volume import snapshots -from cinder.api.openstack.volume import volumes from cinder.api.openstack.volume import versions +from cinder.api.openstack.volume import volumes from cinder.api.openstack import wsgi from cinder import flags from cinder.openstack.common import log as logging diff --git a/run_tests.sh b/run_tests.sh index e1ea0855a..63d6189cb 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -116,7 +116,7 @@ function run_pep8 { # # Until all these issues get fixed, ignore. - ignore='--ignore=N4,N306' + ignore='--ignore=N4,E12,E711,E712,E721,E502' ${wrapper} python tools/hacking.py ${ignore} ${srcfiles} } diff --git a/tools/hacking.py b/tools/hacking.py index 545157bd6..8d20189ed 100755 --- a/tools/hacking.py +++ b/tools/hacking.py @@ -88,7 +88,7 @@ def cinder_except_format(logical_line): N201 """ if logical_line.startswith("except:"): - return 6, "CINDER N201: no 'except:' at least use 'except Exception:'" + yield 6, "CINDER N201: no 'except:' at least use 'except Exception:'" def cinder_except_format_assert(logical_line): @@ -99,7 +99,7 @@ def cinder_except_format_assert(logical_line): N202 """ if logical_line.startswith("self.assertRaises(Exception"): - return 1, "CINDER N202: assertRaises Exception too broad" + yield 1, "CINDER N202: assertRaises Exception too broad" def cinder_one_import_per_line(logical_line): @@ -117,7 +117,7 @@ def cinder_one_import_per_line(logical_line): if pos > -1 and (parts[0] == "import" or parts[0] == "from" and parts[2] == "import") and \ not is_import_exception(parts[1]): - return pos, "CINDER N301: one import per line" + yield pos, "CINDER N301: one import per line" _missingImport = set([]) @@ -191,7 +191,9 @@ def cinder_import_module_only(logical_line): (len(split_line) == 2 or (len(split_line) == 4 and split_line[2] == "as"))): mod = split_line[1] - return importModuleCheck(mod) + rval = importModuleCheck(mod) + if rval != None: + yield rval # TODO(jogo) handle "from x import *" @@ -348,7 +350,7 @@ def cinder_localization_strings(logical_line, tokens): map(gen.send, tokens) gen.close() except LocalizationError as e: - return e.args + yield e.args #TODO(jogo) Dict and list objects diff --git a/tools/test-requires b/tools/test-requires index 7e7f3246e..9f78c1a30 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -7,7 +7,7 @@ nose nosexcover openstack.nose_plugin nosehtmloutput -pep8==1.1 +pep8==1.3.3 pylint==0.25.2 sphinx>=1.1.2 MySQL-python diff --git a/tox.ini b/tox.ini index afb9d3317..47a65cce7 100644 --- a/tox.ini +++ b/tox.ini @@ -13,11 +13,11 @@ deps = -r{toxinidir}/tools/pip-requires commands = /bin/bash run_tests.sh -N -P {posargs} [testenv:pep8] -deps = pep8==1.1 +deps = pep8==1.3.3 commands = - python tools/hacking.py --ignore=N4,E12,E711,E721 --repeat --show-source \ + python tools/hacking.py --ignore=N4,E12,E711,E712,E721,E502 --repeat --show-source \ --exclude=.venv,.tox,dist,doc,openstack,*egg . - python tools/hacking.py --ignore=N4,E12,E711,E721 --repeat --show-source \ + python tools/hacking.py --ignore=N4,E12,E711,E712,E721,E502 --repeat --show-source \ --filename=cinder* bin [testenv:venv]