summaryrefslogtreecommitdiffstats
path: root/tests/unit/rpc/test_kombu.py
diff options
context:
space:
mode:
authorChuck Short <chuck.short@canonical.com>2013-05-01 11:22:23 -0500
committerChuck Short <chuck.short@canonical.com>2013-05-06 15:52:26 -0500
commitfde1e156a38633ce9018569145390bce2047fea8 (patch)
treeff31b1d70f5e6e35cff4a40101db0ea90ed58bcb /tests/unit/rpc/test_kombu.py
parent0c9047cc334578f9f4974c3bc006ba9bc62814d2 (diff)
downloadoslo-fde1e156a38633ce9018569145390bce2047fea8.tar.gz
oslo-fde1e156a38633ce9018569145390bce2047fea8.tar.xz
oslo-fde1e156a38633ce9018569145390bce2047fea8.zip
Convert unicode for python3 portability
From http://docs.python.org/3.1/whatsnew/3.0.html: "Python 3.0 uses the concepts of text and (binary) data instead of Unicode strings and 8-bit strings." Use six.text_type to Type for representing (Unicode) textual data. This is unicode() in Python 2 and str in Python 3. Change-Id: I3da268a714a34a8e626a2590f01b86e414dc3411 Signed-off-by: Chuck Short <chuck.short@canonical.com>
Diffstat (limited to 'tests/unit/rpc/test_kombu.py')
-rw-r--r--tests/unit/rpc/test_kombu.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/unit/rpc/test_kombu.py b/tests/unit/rpc/test_kombu.py
index ae07bed..73ce2ce 100644
--- a/tests/unit/rpc/test_kombu.py
+++ b/tests/unit/rpc/test_kombu.py
@@ -26,6 +26,7 @@ import contextlib
import logging
import mock
+import six
from oslo.config import cfg
from openstack.common import exception
@@ -465,9 +466,10 @@ class RpcKombuTestCase(amqp.BaseRpcAMQPTestCase):
"args": {"value": value}})
self.fail("should have thrown Exception")
except NotImplementedError as exc:
- self.assertTrue(value in unicode(exc))
+ self.assertTrue(value in six.text_type(exc))
#Traceback should be included in exception message
- self.assertTrue('raise NotImplementedError(value)' in unicode(exc))
+ self.assertTrue('raise NotImplementedError(value)' in
+ six.text_type(exc))
def test_call_converted_exception(self):
"""Test that exception gets passed back properly.
@@ -492,9 +494,9 @@ class RpcKombuTestCase(amqp.BaseRpcAMQPTestCase):
"args": {"value": value}})
self.fail("should have thrown Exception")
except exception.ApiError as exc:
- self.assertTrue(value in unicode(exc))
+ self.assertTrue(value in six.text_type(exc))
#Traceback should be included in exception message
- self.assertTrue('exception.ApiError' in unicode(exc))
+ self.assertTrue('exception.ApiError' in six.text_type(exc))
def test_create_worker(self):
meth = 'declare_topic_consumer'