From 1642071febdcb474c2a4f41dd2f7fb477eef125f Mon Sep 17 00:00:00 2001 From: Kenneth Giusti Date: Mon, 5 Jun 2017 14:07:26 -0400 Subject: [PATCH] Fix serializer tests The serializer tests occasionally fail since the order of a dict() is not guaranteed. Explicitly compute the serializer instead of pre-computing it. Change-Id: I74f8fa227e6508491b5982fe7e2841683724540c --- oslo_messaging/tests/rpc/test_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/oslo_messaging/tests/rpc/test_client.py b/oslo_messaging/tests/rpc/test_client.py index 612308720..e955167fd 100755 --- a/oslo_messaging/tests/rpc/test_client.py +++ b/oslo_messaging/tests/rpc/test_client.py @@ -348,13 +348,13 @@ class TestSerializer(test_utils.BaseTestCase): serializer.deserialize_entity = mock.Mock() serializer.serialize_context = mock.Mock() + def _stub(ctxt, arg): + return 's' + arg + msg = dict(method='foo', args=dict()) - expected_side_effect = [] for k, v in self.args.items(): msg['args'][k] = 's' + v - expected_side_effect.append('s' + v) - - serializer.serialize_entity.side_effect = expected_side_effect + serializer.serialize_entity.side_effect = _stub if self.call: serializer.deserialize_entity.return_value = 'd' + self.retval