Port test_exception to Python 3
* FakeNovaException_Remote: on Python 3, define a __str__() method instead of __unicode__() method. str(exc) now calls __str__() now Pyton 3, __unicode__() is no more used. * tox.ini: add nova.tests.unit.test_exception to Python 3. Blueprint nova-python3 Change-Id: Ia3e3f253aa57b75a47f3ba044d2c539f9ce48aea
This commit is contained in:
parent
49873d8f6d
commit
ee4a2a4bb7
|
@ -123,8 +123,12 @@ class NovaExceptionTestCase(test.NoDBTestCase):
|
|||
class FakeNovaException_Remote(exception.NovaException):
|
||||
msg_fmt = "some message"
|
||||
|
||||
def __unicode__(self):
|
||||
return u"print the whole trace"
|
||||
if six.PY3:
|
||||
def __str__(self):
|
||||
return "print the whole trace"
|
||||
else:
|
||||
def __unicode__(self):
|
||||
return u"print the whole trace"
|
||||
|
||||
exc = FakeNovaException_Remote()
|
||||
self.assertEqual(six.text_type(exc), u"print the whole trace")
|
||||
|
|
Loading…
Reference in New Issue