test/: PEP8 compliancy (#24803)

* test/: PEP8 compliancy

- Make PEP8 compliant

* Python3 chokes on casting int to bytes (#24952)

But if we tell the formatter that the var is a number, it works
This commit is contained in:
Dag Wieers 2017-05-30 19:05:19 +02:00 committed by John R Barker
parent 31c59ad5f9
commit 4efec414e7
110 changed files with 1702 additions and 1547 deletions

View file

@ -7,19 +7,22 @@ ${prefix}-snapshot. prefix will be forced to lowercase, to ensure the names are
legal GCE resource names.
'''
import sys
import optparse
import gce_credentials
import optparse
import sys
def parse_args():
parser = optparse.OptionParser(
usage="%s [options] <prefix>" % (sys.argv[0],), description=__doc__)
usage="%s [options] <prefix>" % (sys.argv[0],), description=__doc__
)
gce_credentials.add_credentials_options(parser)
parser.add_option("--prefix",
action="store", dest="prefix",
help="String used to prefix GCE resource names (default: %default)")
parser.add_option(
"--prefix",
action="store",
dest="prefix",
help="String used to prefix GCE resource names (default: %default)"
)
(opts, args) = parser.parse_args()
gce_credentials.check_required(opts, parser)
@ -27,6 +30,7 @@ def parse_args():
parser.error("Missing required argument: name prefix")
return (opts, args)
if __name__ == '__main__':
(opts, args) = parse_args()
@ -34,9 +38,8 @@ if __name__ == '__main__':
prefix = args[0].lower()
try:
base_volume = gce.create_volume(
size=10, name=prefix+'-base', location='us-central1-a')
gce.create_volume_snapshot(base_volume, name=prefix+'-snapshot')
gce.create_volume(
size=10, name=prefix+'-extra', location='us-central1-a')
size=10, name=prefix + '-base', location='us-central1-a')
gce.create_volume_snapshot(base_volume, name=prefix + '-snapshot')
gce.create_volume(size=10, name=prefix + '-extra', location='us-central1-a')
except KeyboardInterrupt as e:
print("\nExiting on user command.")