Merge "Replace try/except/else with self.assertRaises."
diff --git a/tempest/tests/compute/admin/test_quotas.py b/tempest/tests/compute/admin/test_quotas.py
index 7430a7c..46a0c20 100644
--- a/tempest/tests/compute/admin/test_quotas.py
+++ b/tempest/tests/compute/admin/test_quotas.py
@@ -122,15 +122,10 @@
resp, quota_set = self.adm_client.update_quota_set(self.demo_tenant_id,
cores=vcpu_quota)
- try:
- self.create_server()
- except exceptions.OverLimit:
- pass
- else:
- self.fail("Could create servers over the VCPU quota limit")
- finally:
- self.adm_client.update_quota_set(self.demo_tenant_id,
- cores=default_vcpu_quota)
+
+ self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
+ cores=default_vcpu_quota)
+ self.assertRaises(exceptions.OverLimit, self.create_server)
def test_create_server_when_memory_quota_is_full(self):
# Disallow server creation when tenant's memory quota is full