From cd6db6d4faae1bea073750dbc6a39dc8b1e772ab Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Thu, 13 Dec 2012 16:11:54 +0100 Subject: [PATCH] Get rid of naked "except:" clauses in tests Change-Id: Idec15ef86ff0f9cb57b4a8c522e4f5ed63bad010 Signed-off-by: Zane Bitter --- heat/tests/functional/test_CFN_API_Actions.py | 3 +-- heat/tests/functional/test_CFN_API_Actions_Boto.py | 3 +-- heat/tests/functional/test_CFN_API_UpdateStack.py | 3 +-- heat/tests/functional/verify.py | 2 +- heat/tests/test_s3.py | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/heat/tests/functional/test_CFN_API_Actions.py b/heat/tests/functional/test_CFN_API_Actions.py index a8441bce..fda59e01 100644 --- a/heat/tests/functional/test_CFN_API_Actions.py +++ b/heat/tests/functional/test_CFN_API_Actions.py @@ -86,9 +86,8 @@ class CfnApiFunctionalTest(unittest.TestCase): # Match the expected format for an instance's physical resource ID cls.phys_res_id_re = re.compile( "^[0-9a-z]*-[0-9a-z]*-[0-9a-z]*-[0-9a-z]*-[0-9a-z]*$") - except: + finally: cls.stack.cleanup() - raise @classmethod def teardownAll(cls): diff --git a/heat/tests/functional/test_CFN_API_Actions_Boto.py b/heat/tests/functional/test_CFN_API_Actions_Boto.py index 35cd544d..4a966811 100644 --- a/heat/tests/functional/test_CFN_API_Actions_Boto.py +++ b/heat/tests/functional/test_CFN_API_Actions_Boto.py @@ -88,9 +88,8 @@ class CfnApiBotoFunctionalTest(unittest.TestCase): # Match the expected format for an instance's physical resource ID cls.phys_res_id_re = re.compile( "^[0-9a-z]*-[0-9a-z]*-[0-9a-z]*-[0-9a-z]*-[0-9a-z]*$") - except: + finally: cls.stack.cleanup() - raise @classmethod def teardownAll(cls): diff --git a/heat/tests/functional/test_CFN_API_UpdateStack.py b/heat/tests/functional/test_CFN_API_UpdateStack.py index 540d27d1..c1bfbf6f 100644 --- a/heat/tests/functional/test_CFN_API_UpdateStack.py +++ b/heat/tests/functional/test_CFN_API_UpdateStack.py @@ -62,9 +62,8 @@ class CfnApiUpdateStackFunctionalTest(unittest.TestCase): cls.WikiDatabase.wait_for_provisioning() cls.logical_resource_status = "CREATE_COMPLETE" cls.stack_status = "CREATE_COMPLETE" - except: + finally: cls.stack.cleanup() - raise @classmethod def teardownAll(cls): diff --git a/heat/tests/functional/verify.py b/heat/tests/functional/verify.py index d9bc235f..eab10700 100644 --- a/heat/tests/functional/verify.py +++ b/heat/tests/functional/verify.py @@ -60,7 +60,7 @@ class VerifyStack: print "Reading html from %s" % url try: content = urllib2.urlopen(url).read() - except: + except IOError: return False matches = re.findall(regex, content) diff --git a/heat/tests/test_s3.py b/heat/tests/test_s3.py index d5bdec7e..ec4076b8 100644 --- a/heat/tests/test_s3.py +++ b/heat/tests/test_s3.py @@ -29,7 +29,7 @@ from utils import skip_if try: from swiftclient import client as swiftclient -except: +except ImportError: skip_test = True else: skip_test = False -- 2.45.2