Merge "Enable pep8 F841 checking."

This commit is contained in:
Jenkins 2013-07-23 06:36:51 +00:00 committed by Gerrit Code Review
commit 6954c02f4d
17 changed files with 14 additions and 41 deletions

View File

@ -72,10 +72,10 @@ class CreateDomain(workflows.Workflow):
try:
LOG.info('Creating domain with name "%s"' % data['name'])
desc = data['description']
new_domain = api.keystone.domain_create(request,
name=data['name'],
description=desc,
enabled=data['enabled'])
api.keystone.domain_create(request,
name=data['name'],
description=desc,
enabled=data['enabled'])
except:
exceptions.handle(request, ignore=True)
return False

View File

@ -164,7 +164,6 @@ class FlavorsTests(test.BaseAdminViewTests):
'flavor_get'), })
def test_edit_flavor_set_invalid_name(self):
flavor_a = self.flavors.list()[0]
flavor_b = self.flavors.list()[1]
eph = getattr(flavor_a, 'OS-FLV-EXT-DATA:ephemeral')
invalid_flavor_name = "m1.tiny()"

View File

@ -39,7 +39,7 @@ class CreateGroupForm(forms.SelfHandlingForm):
try:
LOG.info('Creating group with name "%s"' % data['name'])
domain_context = request.session.get('domain_context', None)
new_group = api.keystone.group_create(
api.keystone.group_create(
request,
domain_id=domain_context,
name=data['name'],

View File

@ -1064,6 +1064,6 @@ class UpdateProjectWorkflowTests(test.BaseAdminViewTests):
# step action cannot be instantiated
logging.disable(logging.ERROR)
with self.assertRaises(exceptions.NotFound):
res = self.client.get(url)
self.client.get(url)
finally:
logging.disable(logging.NOTSET)

View File

@ -47,8 +47,6 @@ class RolesViewTests(test.BaseAdminViewTests):
@test.create_stubs({api.keystone: ('role_list',
'keystone_can_edit_role', )})
def test_index_with_keystone_can_edit_role_false(self):
role = self.roles.first()
api.keystone.role_list(IgnoreArg()).AndReturn(self.roles.list())
api.keystone.keystone_can_edit_role() \
.MultipleTimes().AndReturn(False)

View File

@ -36,7 +36,6 @@ class ImagesAndSnapshotsTests(test.TestCase):
api.cinder: ('volume_snapshot_list', 'volume_get')})
def test_index(self):
images = self.images.list()
snapshots = self.snapshots.list()
volumes = self.volumes.list()
for volume in volumes:

View File

@ -702,8 +702,6 @@ class InstanceTests(test.TestCase):
server_groups = [secgroups[0], secgroups[1]]
wanted_groups = [secgroups[1].id, secgroups[2].id]
expect_add = secgroups[2].id
expect_rm = secgroups[0].id
api.nova.server_get(IsA(http.HttpRequest), server.id).AndReturn(server)
api.network.security_group_list(IsA(http.HttpRequest)) \
@ -925,7 +923,6 @@ class InstanceTests(test.TestCase):
server = self.servers.first()
volume = self.volumes.first()
sec_group = self.security_groups.first()
avail_zone = self.availability_zones.first()
customization_script = 'user data'
device_name = u'vda'
volume_choice = "%s:vol" % volume.id
@ -1491,7 +1488,6 @@ class InstanceTests(test.TestCase):
api.glance: ('image_list_detailed',)})
def test_select_default_keypair_if_only_one(self):
keypair = self.keypairs.first()
image = self.images.first()
cinder.volume_list(IsA(http.HttpRequest)) \
.AndReturn(self.volumes.list())

View File

@ -60,8 +60,6 @@ class LoadBalancerTests(test.TestCase):
def set_up_expect(self):
# retrieve pools
subnet = self.subnets.first()
vip1 = self.vips.first()
vip2 = self.vips.list()[1]

View File

@ -107,7 +107,7 @@ class AddPool(workflows.Workflow):
def handle(self, request, context):
try:
pool = api.lbaas.pool_create(request, **context)
api.lbaas.pool_create(request, **context)
return True
except:
return False

View File

@ -218,8 +218,8 @@ class CreateSubnetDetailAction(workflows.Action):
'Destination CIDR and nexthop must be specified '
'(value=%s)') % r
raise forms.ValidationError(msg)
dest = self._convert_ip_network(route[0], "host_routes")
nexthop = self._convert_ip_address(route[1], "host_routes")
self._convert_ip_network(route[0], "host_routes")
self._convert_ip_address(route[1], "host_routes")
def clean(self):
cleaned_data = super(CreateSubnetDetailAction, self).clean()

View File

@ -112,7 +112,7 @@ class DetailView(tables.MultiTableView):
expand_subnet=False)
ext_net.set_id_as_name_if_empty(length=0)
router.external_gateway_info['network'] = ext_net.name
except Exception as e:
except Exception:
msg = _('Unable to retrieve an external network "%s".') \
% (ext_net_id)
exceptions.handle(self.request, msg)

View File

@ -569,23 +569,10 @@ class VolumeViewTests(test.TestCase):
'tenant_absolute_limits', 'volume_list',),
api.glance: ('image_list_detailed',)})
def test_create_volume_cannot_encrypt(self):
volume = self.volumes.first()
volume_type = self.volume_types.first()
usage = {'gigabytes': {'available': 250}, 'volumes': {'available': 6}}
formData = {'name': u'An Encrypted Volume',
'description': u'This volume has metadata for encryption.',
'method': u'CreateForm',
'type': volume_type.name,
'size': 50,
'snapshot_source': '',
'encryption': u'LUKS'}
# check that widget is hidden if can_encrypt_volumes = false
PREV = settings.OPENSTACK_HYPERVISOR_FEATURES['can_encrypt_volumes']
settings.OPENSTACK_HYPERVISOR_FEATURES['can_encrypt_volumes'] = False
volume = self.volumes.first()
volume_type = self.volume_types.first()
usage_limit = {'maxTotalVolumeGigabytes': 250,
'gigabytesUsed': 20,
'maxTotalVolumes': 6}

View File

@ -108,8 +108,6 @@ class CreateView(forms.ModalFormView):
def get_context_data(self, **kwargs):
context = super(CreateView, self).get_context_data(**kwargs)
try:
tenant_id = self.kwargs.get('tenant_id',
self.request.user.tenant_id)
context['usages'] = cinder.tenant_absolute_limits(self.request)
volumes = cinder.volume_list(self.request)
total_size = sum([getattr(volume, 'size', 0) for volume

View File

@ -53,7 +53,7 @@ class PasswordForm(forms.SelfHandlingForm):
if user_is_editable:
try:
passwd = api.keystone.user_update_own_password(request,
api.keystone.user_update_own_password(request,
data['current_password'],
data['new_password'])
messages.success(request, _('Password changed.'))

View File

@ -293,7 +293,7 @@ class NetworkApiNeutronSecurityGroupTests(NetworkApiNeutronTestBase):
.AndReturn({'security_groups': secgroups})
self.mox.ReplayAll()
ret = api.network.server_security_groups(self.request, instance_id)
api.network.server_security_groups(self.request, instance_id)
def test_server_update_security_groups(self):
cur_sg_ids = [self.api_q_secgroups.first()['id']]
@ -306,7 +306,7 @@ class NetworkApiNeutronSecurityGroupTests(NetworkApiNeutronTestBase):
body = {'port': {'security_groups': new_sg_ids}}
self.qclient.update_port(p['id'], body=body).AndReturn({'port': p})
self.mox.ReplayAll()
ret = api.network.server_update_security_groups(
api.network.server_update_security_groups(
self.request, instance_id, new_sg_ids)
def test_security_group_backend(self):

View File

@ -193,7 +193,6 @@ def data(TEST):
'network_id': network_dict['id'],
'tenant_id': network_dict['tenant_id']}
ext_net = network_dict
ext_subnet = subnet_dict
TEST.api_networks.add(network_dict)
TEST.api_subnets.add(subnet_dict)

View File

@ -38,7 +38,6 @@ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,p
# E128 continuation line under-indented for visual indent
# F401 '<smth>' imported but unused
# F403 'from <smth> import *' used; unable to detect undefined names
# F841 local variable '<smth>' is assigned to but never used
# F999 syntax error in doctest
# H201 no 'except:' at least use 'except Exception:'
# H302 import only modules.'from optparse import make_option' does not import a module
@ -46,4 +45,4 @@ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,p
# H4xx docstrings
# H701 empty localization string
# H702 Formatting operation should be outside of localization method call
ignore = E121,E126,E127,E128,F403,F841,F999,H201,H302,H303,H4,H701,H702
ignore = E121,E126,E127,E128,F403,F999,H201,H302,H303,H4,H701,H702