Merge "Fix use of except in tempest."
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index b620453..d711c3c 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -107,7 +107,7 @@
resp, body = self.http_obj.request(auth_url, 'GET', **params)
try:
return resp['x-auth-token'], resp['x-server-management-url']
- except:
+ except Exception:
raise
def keystone_auth(self, user, password, auth_url, service, tenant_name):
diff --git a/tempest/tests/compute/admin/test_quotas.py b/tempest/tests/compute/admin/test_quotas.py
index 75684a0..b9474e5 100644
--- a/tempest/tests/compute/admin/test_quotas.py
+++ b/tempest/tests/compute/admin/test_quotas.py
@@ -73,7 +73,7 @@
resp, quota_set = self.client.get_quota_set(self.demo_tenant_id)
self.assertEqual(200, resp.status)
self.assertSequenceEqual(expected_quota_set, quota_set)
- except:
+ except Exception:
self.fail("Admin could not get the default quota set for a tenant")
def test_update_all_quota_resources_for_tenant(self):
@@ -91,7 +91,7 @@
**new_quota_set)
self.assertEqual(200, resp.status)
self.assertSequenceEqual(new_quota_set, quota_set)
- except:
+ except Exception:
self.fail("Admin could not update quota set for the tenant")
finally:
# Reset quota resource limits to default values
@@ -109,7 +109,7 @@
resp, quota_set = self.client.get_quota_set(self.demo_tenant_id)
self.assertEqual(200, resp.status)
self.assertEqual(quota_set['ram'], 5120)
- except:
+ except Exception:
self.fail("Could not get the update quota limit for resource")
finally:
# Reset quota resource limits to default values
diff --git a/tempest/tests/compute/base.py b/tempest/tests/compute/base.py
index eb8b443..5094b46 100644
--- a/tempest/tests/compute/base.py
+++ b/tempest/tests/compute/base.py
@@ -199,7 +199,7 @@
while True:
try:
condition()
- except:
+ except Exception:
pass
else:
return
diff --git a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
index 19da084..de6eca3 100644
--- a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
@@ -124,7 +124,7 @@
#Deleting the non existent floating IP
try:
resp, body = self.client.delete_floating_ip(self.non_exist_id)
- except:
+ except Exception:
pass
else:
self.fail('Should not be able to delete a nonexistent floating IP')
diff --git a/tempest/tests/compute/images/test_images.py b/tempest/tests/compute/images/test_images.py
index b048c58..1fbbf2e 100644
--- a/tempest/tests/compute/images/test_images.py
+++ b/tempest/tests/compute/images/test_images.py
@@ -93,7 +93,7 @@
meta = {'image_type': 'test'}
resp, body = self.client.create_image(server['id'], name, meta)
- except:
+ except Exception:
pass
else:
@@ -199,7 +199,7 @@
snapshot_name = rand_name('a' * 260)
self.assertRaises(exceptions.BadRequest, self.client.create_image,
server['id'], snapshot_name)
- except:
+ except Exception:
self.fail("Should return 400 Bad Request if image name is over 256"
" characters")
@@ -211,7 +211,7 @@
test_uuid = ('a' * 35)
self.assertRaises(exceptions.NotFound, self.client.create_image,
test_uuid, snapshot_name)
- except:
+ except Exception:
self.fail("Should return 404 Not Found if server uuid is 35"
" characters or less")
@@ -223,7 +223,7 @@
test_uuid = ('a' * 37)
self.assertRaises(exceptions.NotFound, self.client.create_image,
test_uuid, snapshot_name)
- except:
+ except Exception:
self.fail("Should return 404 Not Found if server uuid is 37"
" characters or more")
@@ -238,7 +238,7 @@
self.assertRaises(exceptions.BadRequest,
self.client.create_image, server['id'],
snapshot_name)
- except:
+ except Exception:
self.fail("Should return 400 Bad Request if multi byte characters"
" are used for image name")
@@ -254,7 +254,7 @@
self.assertRaises(exceptions.BadRequest, self.client.create_image,
server['id'], snapshot_name, meta)
- except:
+ except Exception:
self.fail("Should raise 400 Bad Request if meta data is invalid")
@attr(type='negative')
@@ -269,7 +269,7 @@
self.assertRaises(exceptions.OverLimit, self.client.create_image,
server['id'], snapshot_name, meta)
- except:
+ except Exception:
self.fail("Should raise 413 Over Limit if meta data was too long")
@attr(type='negative')
@@ -301,7 +301,7 @@
try:
self.assertRaises(exceptions.NotFound, self.client.delete_image,
'')
- except:
+ except Exception:
self.fail("Did not return HTTP 404 NotFound for blank image id")
@attr(type='negative')
@@ -312,7 +312,7 @@
try:
self.assertRaises(exceptions.NotFound, self.client.delete_image,
image_id)
- except:
+ except Exception:
self.fail("Did not return HTTP 404 NotFound for non hex image")
@attr(type='negative')
@@ -322,7 +322,7 @@
try:
self.assertRaises(exceptions.NotFound, self.client.delete_image,
-1)
- except:
+ except Exception:
self.fail("Did not return HTTP 404 NotFound for negative image id")
@attr(type='negative')
@@ -332,7 +332,7 @@
try:
self.assertRaises(exceptions.NotFound, self.client.delete_image,
'11a22b9-120q-5555-cc11-00ab112223gj-3fac')
- except:
+ except Exception:
self.fail("Did not return HTTP 404 NotFound for image id that "
"exceeds 35 character ID length limit")
diff --git a/tempest/tests/compute/images/test_images_whitebox.py b/tempest/tests/compute/images/test_images_whitebox.py
index 40433a7..8eb258c 100644
--- a/tempest/tests/compute/images/test_images_whitebox.py
+++ b/tempest/tests/compute/images/test_images_whitebox.py
@@ -73,7 +73,7 @@
self.assertRaises(exceptions.Duplicate,
self.client.create_image,
self.shared_server['id'], image_name)
- except:
+ except Exception:
self.fail("Should not allow create image when vm_state=%s and "
"task_state=%s" % (vm_state, task_state))
finally:
diff --git a/tempest/tests/compute/images/test_list_image_filters.py b/tempest/tests/compute/images/test_list_image_filters.py
index c27d381..fd19369 100644
--- a/tempest/tests/compute/images/test_list_image_filters.py
+++ b/tempest/tests/compute/images/test_list_image_filters.py
@@ -243,7 +243,7 @@
"""Negative test: GET on non existant image should fail"""
try:
resp, image = self.client.get_image(999)
- except:
+ except Exception:
pass
else:
self.fail('GET on non existant image should fail')
diff --git a/tempest/tests/compute/keypairs/test_keypairs.py b/tempest/tests/compute/keypairs/test_keypairs.py
index 43ad076..447d965 100644
--- a/tempest/tests/compute/keypairs/test_keypairs.py
+++ b/tempest/tests/compute/keypairs/test_keypairs.py
@@ -93,7 +93,7 @@
public_key = keypair_detail['public_key']
self.assertTrue(public_key is not None,
"Field public_key is empty or not found.")
- except:
+ except Exception:
self.fail("GET keypair details requested by keypair name "
"has failed")
finally:
diff --git a/tempest/tests/compute/servers/test_server_basic_ops.py b/tempest/tests/compute/servers/test_server_basic_ops.py
index 04b1451..3453d86 100644
--- a/tempest/tests/compute/servers/test_server_basic_ops.py
+++ b/tempest/tests/compute/servers/test_server_basic_ops.py
@@ -79,7 +79,7 @@
try:
self.compute_client.security_group_rules.create(
self.secgroup.id, **ruleset)
- except:
+ except Exception:
self.fail("Failed to create rule in security group.")
def test_003_boot_instance(self):
diff --git a/tempest/tests/compute/servers/test_server_metadata.py b/tempest/tests/compute/servers/test_server_metadata.py
index 4022dad..844e394 100644
--- a/tempest/tests/compute/servers/test_server_metadata.py
+++ b/tempest/tests/compute/servers/test_server_metadata.py
@@ -135,7 +135,7 @@
"""Negative test: GET on nonexistant server should not succeed"""
try:
resp, meta = self.client.get_server_metadata_item(999, 'test2')
- except:
+ except Exception:
pass
else:
self.fail('GET on nonexistant server should not succeed')
@@ -147,7 +147,7 @@
"""
try:
resp, metadata = self.client.list_server_metadata(999)
- except:
+ except Exception:
pass
else:
self.fail('List metadata on a non existant server should'
@@ -161,7 +161,7 @@
meta = {'meta1': 'data1'}
try:
resp, metadata = self.client.set_server_metadata(999, meta)
- except:
+ except Exception:
pass
else:
self.fail('Set metadata on a non existant server should'
@@ -175,7 +175,7 @@
meta = {'key1': 'value1', 'key2': 'value2'}
try:
resp, metadata = self.client.update_server_metadata(999, meta)
- except:
+ except Exception:
pass
else:
self.fail('An update should not happen for a nonexistant image')
@@ -191,7 +191,7 @@
#Delete the metadata item
try:
resp, metadata = self.client.delete_server_metadata_item(999, 'd')
- except:
+ except Exception:
pass
else:
self.fail('A delete should not happen for a nonexistant image')
diff --git a/tempest/tests/compute/servers/test_servers_whitebox.py b/tempest/tests/compute/servers/test_servers_whitebox.py
index b3665dd..c02a1a2 100644
--- a/tempest/tests/compute/servers/test_servers_whitebox.py
+++ b/tempest/tests/compute/servers/test_servers_whitebox.py
@@ -149,7 +149,7 @@
self.assertEqual(1, result.deleted)
self.assertEqual('deleted', result.vm_state)
self.assertEqual(None, result.task_state)
- except:
+ except Exception:
self.fail("Should be able to delete a server when vm_state=%s and "
"task_state=%s" % (vm_state, task_state))
@@ -164,7 +164,7 @@
self.assertRaises(exceptions.Unauthorized,
self.client.delete_server,
self.shared_server['id'])
- except:
+ except Exception:
self.fail("Should not allow delete server when vm_state=%s and "
"task_state=%s" % (vm_state, task_state))
finally:
diff --git a/tempest/tests/compute/test_quotas.py b/tempest/tests/compute/test_quotas.py
index d07064f..bf7d648 100644
--- a/tempest/tests/compute/test_quotas.py
+++ b/tempest/tests/compute/test_quotas.py
@@ -45,5 +45,5 @@
resp, quota_set = self.client.get_quota_set(self.tenant_id)
self.assertEqual(200, resp.status)
self.assertSequenceEqual(expected_quota_set, quota_set)
- except:
+ except Exception:
self.fail("Quota set for tenant did not have default limits")
diff --git a/tempest/tests/compute/volumes/test_volumes_list.py b/tempest/tests/compute/volumes/test_volumes_list.py
index 2c09add..5162a85 100644
--- a/tempest/tests/compute/volumes/test_volumes_list.py
+++ b/tempest/tests/compute/volumes/test_volumes_list.py
@@ -83,7 +83,7 @@
resp, volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
- except:
+ except Exception:
if cls.volume_list:
# We could not create all the volumes, though we were able
# to create *some* of the volumes. This is typically
@@ -129,7 +129,7 @@
resp, volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
- except:
+ except Exception:
if cls.volume_list:
# We could not create all the volumes, though we were able
# to create *some* of the volumes. This is typically
diff --git a/tempest/tests/volume/base.py b/tempest/tests/volume/base.py
index f28be7d..f4401ff 100644
--- a/tempest/tests/volume/base.py
+++ b/tempest/tests/volume/base.py
@@ -138,7 +138,7 @@
while True:
try:
condition()
- except:
+ except Exception:
pass
else:
return
diff --git a/tempest/tests/volume/test_volumes_actions.py b/tempest/tests/volume/test_volumes_actions.py
index f76235d..52c270c 100644
--- a/tempest/tests/volume/test_volumes_actions.py
+++ b/tempest/tests/volume/test_volumes_actions.py
@@ -58,7 +58,7 @@
mountpoint)
self.assertEqual(202, resp.status)
self.client.wait_for_volume_status(self.volume['id'], 'in-use')
- except:
+ except Exception:
self.fail("Could not attach volume to instance")
finally:
# Detach the volume from the instance
@@ -83,7 +83,7 @@
self.assertEqual(self.server['id'], attachment['server_id'])
self.assertEqual(self.volume['id'], attachment['id'])
self.assertEqual(self.volume['id'], attachment['volume_id'])
- except:
+ except Exception:
self.fail("Could not get attachment details from volume")
finally:
self.client.detach_volume(self.volume['id'])
diff --git a/tempest/tests/volume/test_volumes_get.py b/tempest/tests/volume/test_volumes_get.py
index fa8e86e..048c340 100644
--- a/tempest/tests/volume/test_volumes_get.py
+++ b/tempest/tests/volume/test_volumes_get.py
@@ -58,7 +58,7 @@
fetched_volume['metadata'],
'The fetched Volume is different '
'from the created Volume')
- except:
+ except Exception:
self.fail("Could not create a volume")
finally:
if volume:
@@ -85,7 +85,7 @@
resp, fetched_volume = self.client.get_volume(volume['id'])
self.assertEqual(200, resp.status)
self.assertEqual(fetched_volume['metadata'], {})
- except:
+ except Exception:
self.fail("Could not get volume metadata")
finally:
if volume:
diff --git a/tempest/tests/volume/test_volumes_list.py b/tempest/tests/volume/test_volumes_list.py
index e9bafaf..b387b15 100644
--- a/tempest/tests/volume/test_volumes_list.py
+++ b/tempest/tests/volume/test_volumes_list.py
@@ -80,7 +80,7 @@
resp, volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
- except:
+ except Exception:
if cls.volume_list:
# We could not create all the volumes, though we were able
# to create *some* of the volumes. This is typically
@@ -126,7 +126,7 @@
resp, volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
- except:
+ except Exception:
if cls.volume_list:
# We could not create all the volumes, though we were able
# to create *some* of the volumes. This is typically