Upgrade to pep8 1.3.3

Also expand scope of what is covered by pep8 test

Change-Id: Ifc8924914b5a0d625bc8df6442ee85eb21459cde
This commit is contained in:
Joe Gordon 2013-02-01 12:13:19 -08:00
parent 3ca976d4a0
commit 96630b8248
5 changed files with 14 additions and 26 deletions

View File

@ -209,7 +209,7 @@ class OpenStackComputeShell(object):
parser = NovaClientArgumentParser(
prog='nova',
description=__doc__.strip(),
epilog='See "nova help COMMAND" '\
epilog='See "nova help COMMAND" '
'for help on a specific command.',
add_help=False,
formatter_class=OpenStackHelpFormatter,

View File

@ -110,7 +110,7 @@ def _boot(cs, args, reservation_id=None, min_count=None, max_count=None):
try:
userdata = open(args.user_data)
except IOError, e:
raise exceptions.CommandError("Can't open '%s': %s" % \
raise exceptions.CommandError("Can't open '%s': %s" %
(args.user_data, e))
else:
userdata = None
@ -200,14 +200,14 @@ def _boot(cs, args, reservation_id=None, min_count=None, max_count=None):
metavar="<key=value>",
action='append',
default=[],
help="Record arbitrary key/value metadata to /meta.js "\
help="Record arbitrary key/value metadata to /meta.js "
"on the new server. Can be specified multiple times.")
@utils.arg('--file',
metavar="<dst-path=src-path>",
action='append',
dest='files',
default=[],
help="Store arbitrary files from <src-path> locally to <dst-path> "\
help="Store arbitrary files from <src-path> locally to <dst-path> "
"on the new server. You may store up to 5 files.")
@utils.arg('--key-name',
metavar='<key-name>',
@ -1961,7 +1961,7 @@ def do_secgroup_delete_group_rule(cs, args):
if (rule.get('ip_protocol') == params.get('ip_protocol') and
rule.get('from_port') == params.get('from_port') and
rule.get('to_port') == params.get('to_port') and
rule.get('group', {}).get('name') == \
rule.get('group', {}).get('name') ==
params.get('group_name')):
return cs.security_group_rules.delete(rule['id'])
@ -1985,7 +1985,7 @@ def do_keypair_add(cs, args):
with open(os.path.expanduser(pub_key)) as f:
pub_key = f.read()
except IOError, e:
raise exceptions.CommandError("Can't open or read '%s': %s" % \
raise exceptions.CommandError("Can't open or read '%s': %s" %
(pub_key, e))
keypair = cs.keypairs.create(name, pub_key)

View File

@ -103,25 +103,11 @@ function copy_subunit_log {
function run_pep8 {
echo "Running pep8 ..."
srcfiles="novaclient tests"
srcfiles="--exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg ."
# 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.
pep8_opts="--ignore=E202,W602 --repeat"
${wrapper} pep8 ${pep8_opts} ${srcfiles}
ignore="--ignore=E12,E711,E721,E712"
${wrapper} pep8 ${ignore} --show-source ${srcfiles}
}
TESTRTESTS="testr run --parallel $testropts"

View File

@ -4,7 +4,7 @@ coverage
discover
fixtures>=0.3.12
mock
pep8==1.1
pep8==1.3.3
sphinx>=1.1.2
testrepository>=0.0.13
testtools>=0.9.26

View File

@ -12,8 +12,10 @@ deps = -r{toxinidir}/tools/pip-requires
commands = python setup.py testr --testr-args='{posargs}'
[testenv:pep8]
deps = pep8==1.1
commands = pep8 --repeat --show-source novaclient setup.py
deps = pep8==1.3.3
commands =
pep8 --ignore=E12,E711,E721,E712 --show-source \
--exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg .
[testenv:venv]
commands = {posargs}