Merge "py37: deal with Exception repr changes"

This commit is contained in:
Zuul 2018-08-03 13:31:48 +00:00 committed by Gerrit Code Review
commit d46afa6ed2
1 changed files with 6 additions and 4 deletions

View File

@ -116,8 +116,9 @@ class JSONUtilsTestMixin(object):
self.assertIsInstance(val, six.text_type)
def test_dumps_exception_value(self):
self.assertEqual('{"a": "ValueError(\'hello\',)"}',
jsonutils.dumps({"a": ValueError("hello")}))
self.assertIn(jsonutils.dumps({"a": ValueError("hello")}),
['{"a": "ValueError(\'hello\',)"}',
'{"a": "ValueError(\'hello\')"}'])
class JSONUtilsTestJson(JSONUtilsTestMixin, test_base.BaseTestCase):
@ -407,5 +408,6 @@ class ToPrimitiveTestCase(test_base.BaseTestCase):
self.assertEqual('fallback', ret)
def test_exception(self):
self.assertEqual("ValueError('an exception',)",
jsonutils.to_primitive(ValueError("an exception")))
self.assertIn(jsonutils.to_primitive(ValueError("an exception")),
["ValueError('an exception',)",
"ValueError('an exception')"])