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
This commit is contained in:
Matthew Treinish 2015-04-23 10:17:17 -04:00
parent 53d0dc04e2
commit 843227d34a
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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):