Merge "Replace oslo_utils.encodeutils.exception_to_unicode"
This commit is contained in:
@@ -17,8 +17,6 @@
|
||||
import pickle
|
||||
import sys
|
||||
|
||||
from oslo_utils import encodeutils
|
||||
|
||||
from taskflow import exceptions
|
||||
from taskflow import test
|
||||
from taskflow.tests import utils as test_utils
|
||||
@@ -334,8 +332,7 @@ class NonAsciiExceptionsTestCase(test.TestCase):
|
||||
bad_string = chr(200)
|
||||
excp = ValueError(bad_string)
|
||||
fail = failure.Failure.from_exception(excp)
|
||||
self.assertEqual(encodeutils.exception_to_unicode(excp),
|
||||
fail.exception_str)
|
||||
self.assertEqual(str(excp), fail.exception_str)
|
||||
expected = u'Failure: ValueError: \xc8'
|
||||
self.assertEqual(expected, str(fail))
|
||||
|
||||
@@ -350,7 +347,7 @@ class NonAsciiExceptionsTestCase(test.TestCase):
|
||||
def test_wrapped_failure_non_ascii_unicode(self):
|
||||
hi_cn = u'嗨'
|
||||
fail = ValueError(hi_cn)
|
||||
self.assertEqual(hi_cn, encodeutils.exception_to_unicode(fail))
|
||||
self.assertEqual(hi_cn, str(fail))
|
||||
fail = failure.Failure.from_exception(fail)
|
||||
wrapped_fail = exceptions.WrappedFailure([fail])
|
||||
expected_result = (u"WrappedFailure: "
|
||||
|
||||
@@ -21,7 +21,6 @@ import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import reflection
|
||||
|
||||
from taskflow import exceptions as exc
|
||||
@@ -29,9 +28,6 @@ from taskflow.utils import iter_utils
|
||||
from taskflow.utils import schema_utils as su
|
||||
|
||||
|
||||
_exception_message = encodeutils.exception_to_unicode
|
||||
|
||||
|
||||
def _copy_exc_info(exc_info):
|
||||
if exc_info is None:
|
||||
return None
|
||||
@@ -57,7 +53,7 @@ def _are_equal_exc_info_tuples(ei1, ei2):
|
||||
# because we want the types to be exactly the same, not just have
|
||||
# one be inherited from the other.
|
||||
if not all((type(ei1[1]) == type(ei2[1]), # noqa: E721
|
||||
_exception_message(ei1[1]) == _exception_message(ei2[1]),
|
||||
str(ei1[1]) == str(ei2[1]),
|
||||
repr(ei1[1]) == repr(ei2[1]))):
|
||||
return False
|
||||
if ei1[2] == ei2[2]:
|
||||
@@ -195,7 +191,7 @@ class Failure():
|
||||
if not self._exc_type_names:
|
||||
raise TypeError("Invalid exception type '%s' (%s)"
|
||||
% (exc_info[0], type(exc_info[0])))
|
||||
self._exception_str = _exception_message(self._exc_info[1])
|
||||
self._exception_str = str(self._exc_info[1])
|
||||
self._traceback_str = ''.join(
|
||||
traceback.format_tb(self._exc_info[2]))
|
||||
self._causes = kwargs.pop('causes', None)
|
||||
|
||||
Reference in New Issue
Block a user