From f9649e2615ff1be30bdca1c96b02c2a36dab84ac Mon Sep 17 00:00:00 2001 From: Joe Heck Date: Wed, 21 Nov 2012 21:48:12 +0000 Subject: [PATCH] updating PEP8 to 1.3.3 * matching cinder, glance, etc * made run_tests exclusions match tox Change-Id: I9963245b079535a38a8c9b46917e8d833b62addb --- run_tests.sh | 23 +++-------------------- tools/install_venv.py | 7 ++++--- tools/test-requires | 2 +- tox.ini | 2 +- 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index dff694848..782c36561 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -78,27 +78,10 @@ function run_pep8 { srcfiles="keystoneclient tests" # Just run PEP8 in current environment # - # NOTE(sirp): W602 (deprecated 3-arg raise) is being ignored for the - # following reasons: - # - # 1. It's needed to preserve traceback information when re-raising - # exceptions; this is needed b/c Eventlet will clear exceptions when - # switching contexts. - # - # 2. There doesn't appear to be an alternative, "pep8-tool" compatible way of doing this - # in Python 2 (in Python 3 `with_traceback` could be used). - # - # 3. Can find no corroborating evidence that this is deprecated in Python 2 - # other than what the PEP8 tool claims. It is deprecated in Python 3, so, - # perhaps the mistake was thinking that the deprecation applied to Python 2 - # as well. - # - # NOTE(henry-nash): Added exlusion of the openstack.common dir (as - # is the case in other projects, since some of the common files - # don't pass pep8. Clearly we should come back a fix this - # + # NOTE(heckj): E125, E126 are being ignored matching other openstack projects + # for pep 1.3.3 due to relatively arbitrary line indentation rulings ${wrapper} pep8 --repeat --show-pep8 --show-source \ - --ignore=E202,W602 --exclude=openstack \ + --ignore=E125,E126 --exclude=.venv,.tox,dist,doc \ ${srcfiles} } diff --git a/tools/install_venv.py b/tools/install_venv.py index ecfc93eae..06dced8e5 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -169,7 +169,7 @@ class Suse(Distro): def get_distro(): if (os.path.exists('/etc/fedora-release') or - os.path.exists('/etc/redhat-release')): + os.path.exists('/etc/redhat-release')): return Fedora() elif os.path.exists('/etc/SuSE-release'): return Suse() @@ -218,7 +218,7 @@ def install_dependencies(venv=VENV): # Tell the virtual env how to "import nova" pthfile = os.path.join(venv, "lib", PY_VERSION, "site-packages", - "keystoneclient.pth") + "keystoneclient.pth") f = open(pthfile, 'w') f.write("%s\n" % ROOT) @@ -252,7 +252,8 @@ def print_help(): def parse_args(): """Parse command-line arguments""" parser = optparse.OptionParser() - parser.add_option("-n", "--no-site-packages", dest="no_site_packages", + parser.add_option( + "-n", "--no-site-packages", dest="no_site_packages", default=False, action="store_true", help="Do not inherit packages from global Python install") return parser.parse_args() diff --git a/tools/test-requires b/tools/test-requires index 8d9547be0..69d94ba90 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -7,7 +7,7 @@ nose nose-exclude openstack.nose_plugin nosehtmloutput -pep8==1.2 +pep8==1.3.3 sphinx>=1.1.2 unittest2>=0.5.1 WebOb==1.0.8 diff --git a/tox.ini b/tox.ini index 1b0768daf..6533a18de 100644 --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,7 @@ commands = nosetests {posargs} downloadcache = ~/cache/pip [testenv:pep8] -commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc . +commands = pep8 --repeat --show-source --ignore=E711,E712,E125,E126 --exclude=.venv,.tox,dist,doc . [testenv:cover] setenv = NOSE_WITH_COVERAGE=1