Upgrade to pep8 1.3.3
Also expand scope of what is covered by pep8 test Change-Id: Ifc8924914b5a0d625bc8df6442ee85eb21459cde
This commit is contained in:
parent
3ca976d4a0
commit
96630b8248
|
@ -209,7 +209,7 @@ class OpenStackComputeShell(object):
|
||||||
parser = NovaClientArgumentParser(
|
parser = NovaClientArgumentParser(
|
||||||
prog='nova',
|
prog='nova',
|
||||||
description=__doc__.strip(),
|
description=__doc__.strip(),
|
||||||
epilog='See "nova help COMMAND" '\
|
epilog='See "nova help COMMAND" '
|
||||||
'for help on a specific command.',
|
'for help on a specific command.',
|
||||||
add_help=False,
|
add_help=False,
|
||||||
formatter_class=OpenStackHelpFormatter,
|
formatter_class=OpenStackHelpFormatter,
|
||||||
|
|
|
@ -110,7 +110,7 @@ def _boot(cs, args, reservation_id=None, min_count=None, max_count=None):
|
||||||
try:
|
try:
|
||||||
userdata = open(args.user_data)
|
userdata = open(args.user_data)
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
raise exceptions.CommandError("Can't open '%s': %s" % \
|
raise exceptions.CommandError("Can't open '%s': %s" %
|
||||||
(args.user_data, e))
|
(args.user_data, e))
|
||||||
else:
|
else:
|
||||||
userdata = None
|
userdata = None
|
||||||
|
@ -200,14 +200,14 @@ def _boot(cs, args, reservation_id=None, min_count=None, max_count=None):
|
||||||
metavar="<key=value>",
|
metavar="<key=value>",
|
||||||
action='append',
|
action='append',
|
||||||
default=[],
|
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.")
|
"on the new server. Can be specified multiple times.")
|
||||||
@utils.arg('--file',
|
@utils.arg('--file',
|
||||||
metavar="<dst-path=src-path>",
|
metavar="<dst-path=src-path>",
|
||||||
action='append',
|
action='append',
|
||||||
dest='files',
|
dest='files',
|
||||||
default=[],
|
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.")
|
"on the new server. You may store up to 5 files.")
|
||||||
@utils.arg('--key-name',
|
@utils.arg('--key-name',
|
||||||
metavar='<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
|
if (rule.get('ip_protocol') == params.get('ip_protocol') and
|
||||||
rule.get('from_port') == params.get('from_port') and
|
rule.get('from_port') == params.get('from_port') and
|
||||||
rule.get('to_port') == params.get('to_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')):
|
params.get('group_name')):
|
||||||
return cs.security_group_rules.delete(rule['id'])
|
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:
|
with open(os.path.expanduser(pub_key)) as f:
|
||||||
pub_key = f.read()
|
pub_key = f.read()
|
||||||
except IOError, e:
|
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))
|
(pub_key, e))
|
||||||
|
|
||||||
keypair = cs.keypairs.create(name, pub_key)
|
keypair = cs.keypairs.create(name, pub_key)
|
||||||
|
|
20
run_tests.sh
20
run_tests.sh
|
@ -103,25 +103,11 @@ function copy_subunit_log {
|
||||||
|
|
||||||
function run_pep8 {
|
function run_pep8 {
|
||||||
echo "Running 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
|
# Just run PEP8 in current environment
|
||||||
#
|
#
|
||||||
# NOTE(sirp): W602 (deprecated 3-arg raise) is being ignored for the
|
ignore="--ignore=E12,E711,E721,E712"
|
||||||
# following reasons:
|
${wrapper} pep8 ${ignore} --show-source ${srcfiles}
|
||||||
#
|
|
||||||
# 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}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TESTRTESTS="testr run --parallel $testropts"
|
TESTRTESTS="testr run --parallel $testropts"
|
||||||
|
|
|
@ -4,7 +4,7 @@ coverage
|
||||||
discover
|
discover
|
||||||
fixtures>=0.3.12
|
fixtures>=0.3.12
|
||||||
mock
|
mock
|
||||||
pep8==1.1
|
pep8==1.3.3
|
||||||
sphinx>=1.1.2
|
sphinx>=1.1.2
|
||||||
testrepository>=0.0.13
|
testrepository>=0.0.13
|
||||||
testtools>=0.9.26
|
testtools>=0.9.26
|
||||||
|
|
6
tox.ini
6
tox.ini
|
@ -12,8 +12,10 @@ deps = -r{toxinidir}/tools/pip-requires
|
||||||
commands = python setup.py testr --testr-args='{posargs}'
|
commands = python setup.py testr --testr-args='{posargs}'
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
deps = pep8==1.1
|
deps = pep8==1.3.3
|
||||||
commands = pep8 --repeat --show-source novaclient setup.py
|
commands =
|
||||||
|
pep8 --ignore=E12,E711,E721,E712 --show-source \
|
||||||
|
--exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg .
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
Loading…
Reference in New Issue