From 44ce6eae918d44c0ee85998d0526e916dee8de26 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Thu, 8 Feb 2018 16:58:42 +0000 Subject: Fix invalid json unit test Recent versions of oslo.serialization have made it possible to dump exceptions to JSON, which broke a unit test in taskflow that assumed exceptions were unserializable. This change switches to an explicitly unserializable class for that test. Change-Id: If6d19bc9fcf1f1813cb087d42dc7ba6a61c71b3d Closes-Bug: 1748241 --- taskflow/tests/unit/worker_based/test_protocol.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/taskflow/tests/unit/worker_based/test_protocol.py b/taskflow/tests/unit/worker_based/test_protocol.py index 86a7e89..c253699 100644 --- a/taskflow/tests/unit/worker_based/test_protocol.py +++ b/taskflow/tests/unit/worker_based/test_protocol.py @@ -25,6 +25,10 @@ from taskflow.tests import utils from taskflow.types import failure +class Unserializable(object): + pass + + class TestProtocolValidation(test.TestCase): def test_send_notify(self): msg = pr.Notify() @@ -166,7 +170,7 @@ class TestProtocol(test.TestCase): self.assertEqual(expected, request.to_dict()) def test_to_dict_with_invalid_json_failures(self): - exc = RuntimeError(Exception("I am not valid JSON")) + exc = RuntimeError(Unserializable()) a_failure = failure.Failure.from_exception(exc) request = self.request(failures={self.task.name: a_failure}) expected = self.request_to_dict( -- cgit v1.2.1