[ATest] Fix list ordering issue in unittest.
Sort list before unittest assertion.
Bug: 147787128
Test: source build/envsetup.sh; lunch
croot tools/asuite/atest
./run_atest_unittests.sh # won't see issue of the bug.
./atest_run_unittests.py @ won't see issue of the bug.
Change-Id: I29b35b90b202b203d5c3e093f93191224c556a5e
diff --git a/atest/unittest_utils.py b/atest/unittest_utils.py
index 9171c5d..a2f806f 100644
--- a/atest/unittest_utils.py
+++ b/atest/unittest_utils.py
@@ -27,6 +27,10 @@
assertEqual considers types equal to their subtypes, but we want to
not consider set() and frozenset() equal for testing.
"""
+ # Allow 2 lists with different order but the same content equal.
+ if isinstance(first, list) and isinstance(second, list):
+ first.sort()
+ second.sort()
test_class.assertEqual(first, second)
# allow byte and unicode string equality.
if not (isinstance(first, str) and