Start using Hacking and PyFlakes

Only blacklisting those warnings that are numerous,
so that in principle Hacking and PyFlakes warnings
are tested. Fix the easy ones alongway.

Change-Id: I571f51ebf570ac114509f2dcd71cdce281e7c70a
This commit is contained in:
Dirk Mueller 2013-06-01 15:49:51 +02:00
parent def5df2760
commit 67c80558b1
8 changed files with 9 additions and 10 deletions

View File

@ -50,7 +50,7 @@ class ServiceCatalog(object):
raise novaclient.exceptions.EndpointNotFound() raise novaclient.exceptions.EndpointNotFound()
# We don't always get a service catalog back ... # We don't always get a service catalog back ...
if not 'serviceCatalog' in self.catalog['access']: if 'serviceCatalog' not in self.catalog['access']:
return None return None
# Full catalog ... # Full catalog ...

View File

@ -169,9 +169,9 @@ class ServersTest(utils.TestCase):
{'metadata': {'test_key': 'test_value'}}) {'metadata': {'test_key': 'test_value'}})
def test_find(self): def test_find(self):
s = cs.servers.find(name='sample-server') server = cs.servers.find(name='sample-server')
cs.assert_called('GET', '/servers/detail') cs.assert_called('GET', '/servers/detail')
self.assertEqual(s.name, 'sample-server') self.assertEqual(server.name, 'sample-server')
self.assertRaises(exceptions.NoUniqueMatch, cs.servers.find, self.assertRaises(exceptions.NoUniqueMatch, cs.servers.find,
flavor={"id": 1, "name": "256 MB Server"}) flavor={"id": 1, "name": "256 MB Server"})

View File

@ -14,4 +14,4 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from novaclient.v1_1.client import Client from novaclient.v1_1.client import Client # noqa

View File

@ -170,7 +170,7 @@ class FlavorManager(base.ManagerWithFind):
try: try:
is_public = utils.bool_from_str(is_public) is_public = utils.bool_from_str(is_public)
except: except Exception:
raise exceptions.CommandError("is_public must be a boolean.") raise exceptions.CommandError("is_public must be a boolean.")
body = { body = {

View File

@ -536,7 +536,7 @@ class ServerManager(local_base.BootingManagerWithFind):
key_name=None, availability_zone=None, key_name=None, availability_zone=None,
block_device_mapping=None, nics=None, scheduler_hints=None, block_device_mapping=None, nics=None, scheduler_hints=None,
config_drive=None, **kwargs): config_drive=None, **kwargs):
# TODO: (anthony) indicate in doc string if param is an extension # TODO(anthony): indicate in doc string if param is an extension
# and/or optional # and/or optional
""" """
Create (boot) a new server. Create (boot) a new server.

View File

@ -1251,7 +1251,7 @@ def do_image_create(cs, args):
@utils.arg('rotation', metavar='<rotation>', @utils.arg('rotation', metavar='<rotation>',
help='Int parameter representing how many backups to keep around.') help='Int parameter representing how many backups to keep around.')
def do_backup(cs, args): def do_backup(cs, args):
""" Backup a instance by create a 'backup' type snapshot """ """Backup a instance by create a 'backup' type snapshot """
_find_server(cs, args.server).backup(args.name, _find_server(cs, args.server).backup(args.name,
args.backup_type, args.backup_type,
args.rotation) args.rotation)
@ -3127,7 +3127,7 @@ def do_availability_zone_list(cs, _args):
except exceptions.Forbidden as e: # policy doesn't allow probably except exceptions.Forbidden as e: # policy doesn't allow probably
try: try:
availability_zones = cs.availability_zones.list(detailed=False) availability_zones = cs.availability_zones.list(detailed=False)
except: except Exception:
raise e raise e
result = [] result = []

View File

@ -27,7 +27,6 @@ import optparse
import os import os
import subprocess import subprocess
import sys import sys
import platform
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))

View File

@ -24,6 +24,6 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
downloadcache = ~/cache/pip downloadcache = ~/cache/pip
[flake8] [flake8]
ignore = E12,E711,E721,E712,F,H ignore = E12,E711,E721,E712,F841,F811,F821,H302,H306,H402,H403,H404
show-source = True show-source = True
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build