From 843227d34a2c390831c2b53059a8158ce89e1d3c Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 23 Apr 2015 10:17:17 -0400 Subject: [PATCH] Fix raise syntax in test.py for python3 compat The raise syntax was changed in python3 so the usage of passing in the separate components as different params to raise will not work when running on python 3. This commit updates it to use a syntax which is compatible with python3. Change-Id: I5cb9979e8ba8e324efb95feec33c23238dffade5 --- tempest/test.py | 4 ++-- tempest/thirdparty/boto/test.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tempest/test.py b/tempest/test.py index 2d5e94add2..9d1b807e0f 100644 --- a/tempest/test.py +++ b/tempest/test.py @@ -267,7 +267,7 @@ class BaseTestCase(testtools.testcase.WithAttributes, etype, cls.__name__)) cls.tearDownClass() try: - raise etype, value, trace + six.reraise(etype, value, trace) finally: del trace # to avoid circular refs @@ -305,7 +305,7 @@ class BaseTestCase(testtools.testcase.WithAttributes, # the first one if re_raise and etype is not None: try: - raise etype, value, trace + six.reraise(etype, value, trace) finally: del trace # to avoid circular refs diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py index 4485972dde..1ff4dee1eb 100644 --- a/tempest/thirdparty/boto/test.py +++ b/tempest/thirdparty/boto/test.py @@ -252,9 +252,9 @@ class BotoTestCase(tempest.test.BaseTestCase): except exception.BotoServerError as exc: error_msg = excMatcher.match(exc) if error_msg is not None: - raise self.failureException, error_msg + raise self.failureException(error_msg) else: - raise self.failureException, "BotoServerError not raised" + raise self.failureException("BotoServerError not raised") @classmethod def resource_cleanup(cls):