Merge "Minor Python 3 fixes"
This commit is contained in:
commit
f3e03c9fff
@ -28,6 +28,7 @@ __all__ = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
import six
|
||||||
from stevedore import driver
|
from stevedore import driver
|
||||||
|
|
||||||
from oslo.messaging import exceptions
|
from oslo.messaging import exceptions
|
||||||
@ -352,8 +353,7 @@ class TransportURL(object):
|
|||||||
if not url:
|
if not url:
|
||||||
return cls(conf, aliases=aliases)
|
return cls(conf, aliases=aliases)
|
||||||
|
|
||||||
# FIXME(flaper87): Not PY3K compliant
|
if not isinstance(url, six.string_types):
|
||||||
if not isinstance(url, basestring):
|
|
||||||
raise InvalidTransportURL(url, 'Wrong URL type')
|
raise InvalidTransportURL(url, 'Wrong URL type')
|
||||||
|
|
||||||
url = urlutils.urlparse(url)
|
url = urlutils.urlparse(url)
|
||||||
|
@ -121,6 +121,7 @@ class SerializeRemoteExceptionTestCase(test_utils.BaseTestCase):
|
|||||||
try:
|
try:
|
||||||
raise self.cls(*self.args, **self.kwargs)
|
raise self.cls(*self.args, **self.kwargs)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
cls_error = ex
|
||||||
if self.add_remote:
|
if self.add_remote:
|
||||||
ex = add_remote_postfix(ex)
|
ex = add_remote_postfix(ex)
|
||||||
raise ex
|
raise ex
|
||||||
@ -139,7 +140,7 @@ class SerializeRemoteExceptionTestCase(test_utils.BaseTestCase):
|
|||||||
self.assertEqual(failure['kwargs'], self.kwargs)
|
self.assertEqual(failure['kwargs'], self.kwargs)
|
||||||
|
|
||||||
# Note: _Remote prefix not stripped from tracebacks
|
# Note: _Remote prefix not stripped from tracebacks
|
||||||
tb = ex.__class__.__name__ + ': ' + self.msg
|
tb = cls_error.__class__.__name__ + ': ' + self.msg
|
||||||
self.assertIn(tb, ''.join(failure['tb']))
|
self.assertIn(tb, ''.join(failure['tb']))
|
||||||
|
|
||||||
if self.log_failure:
|
if self.log_failure:
|
||||||
|
Loading…
Reference in New Issue
Block a user