diff options
author | Ana Krivokapic <akrivoka@redhat.com> | 2013-04-15 15:15:02 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-04-19 12:46:25 +0200 |
commit | 18149fadb6a78a736d434634939074ea34bee79b (patch) | |
tree | 3a07e9060ec00c1d19fe225f8fd29e1da048f5b4 /tests/util.py | |
parent | 4f47ac9d7f3d9cb2f1381858b05a7ba851917592 (diff) | |
download | freeipa-18149fadb6a78a736d434634939074ea34bee79b.tar.gz freeipa-18149fadb6a78a736d434634939074ea34bee79b.tar.xz freeipa-18149fadb6a78a736d434634939074ea34bee79b.zip |
Do not sort dictionaries in assert_deepequal utility function
Sorting lists of dictionaries in assert_deepequal was causing inconsistencies
in unit test execution. To fix this, do not sort lists if their elements are
dictionaries.
https://fedorahosted.org/freeipa/ticket/3562
Diffstat (limited to 'tests/util.py')
-rw-r--r-- | tests/util.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/util.py b/tests/util.py index ed62a223a..117d2c834 100644 --- a/tests/util.py +++ b/tests/util.py @@ -316,8 +316,13 @@ def assert_deepequal(expected, got, doc='', stack=tuple()): raise AssertionError( LEN % (doc, len(expected), len(got), expected, got, stack) ) - s_got = sorted(got) - s_expected = sorted(expected) + # Sort list elements, unless they are dictionaries + if expected and isinstance(expected[0], dict): + s_got = got + s_expected = expected + else: + s_got = sorted(got) + s_expected = sorted(expected) for (i, e_sub) in enumerate(s_expected): g_sub = s_got[i] assert_deepequal(e_sub, g_sub, doc, stack + (i,)) |