From eef7159c8bf6f6ad74c6bfca8fb058ac43e1c223 Mon Sep 17 00:00:00 2001 From: Xabier Arbulu Insausti Date: Thu, 5 Mar 2020 10:27:28 +0000 Subject: [PATCH] Fix one UT to make it py2 compatible --- tests/unit/states/test_crmshmod.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/unit/states/test_crmshmod.py b/tests/unit/states/test_crmshmod.py index b5a5d687..126924f5 100644 --- a/tests/unit/states/test_crmshmod.py +++ b/tests/unit/states/test_crmshmod.py @@ -6,6 +6,7 @@ # Import Python libs from __future__ import absolute_import, unicode_literals, print_function +import sys from salt import exceptions # Import Salt Testing Libs @@ -646,7 +647,13 @@ def test_convert2corosync(self): } output = crmshmod._convert2corosync(main_dict, '') - assert output == "a {\n\tb {\n\t\tf: 7\n\t}\n\tc: 2\n}\nd: 3\n" + + # Py2 and py3 have different way of ordering the `items` method + # For the functionality this does not really affect + if sys.version_info[0] == 2: + assert output == "a {\n\tc: 2\n\tb {\n\t\tf: 7\n\t}\n}\nd: 3\n" + else: + assert output == "a {\n\tb {\n\t\tf: 7\n\t}\n\tc: 2\n}\nd: 3\n" @mock.patch('salt.states.crmshmod._convert2dict') @mock.patch('salt.states.crmshmod._mergedicts')