Skip to content

Commit 14a97a8

Browse files
committed
Fix object sort order in tools tests
1 parent fd5abc1 commit 14a97a8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pythonFiles/tests/testing_tools/adapter/test_functional.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ def fix_source(tests, testid, srcfile, lineno):
8383
test["source"] = fix_path("{}:{}".format(srcfile, lineno))
8484

8585

86+
def sorted_object(obj):
87+
if isinstance(obj, dict):
88+
return sorted((key, sorted_object(obj[key])) for key in obj.keys())
89+
if isinstance(obj, list):
90+
return sorted((sorted_object(x) for x in obj))
91+
else:
92+
return obj
93+
8694
# Note that these tests are skipped if util.PATH_SEP is not os.path.sep.
8795
# This is because the functional tests should reflect the actual
8896
# operating environment.
@@ -160,7 +168,7 @@ def test_discover_complex_default(self):
160168
result[0]["tests"] = fix_test_order(result[0]["tests"])
161169

162170
self.maxDiff = None
163-
self.assertEqual(result, expected)
171+
self.assertEqual(sorted_object(result), sorted_object(expected))
164172

165173
@pytest.mark.skip(reason="https://github.com/microsoft/vscode-python/issues/14023")
166174
def test_discover_complex_doctest(self):
@@ -245,7 +253,7 @@ def test_discover_complex_doctest(self):
245253
result[0]["tests"] = fix_test_order(result[0]["tests"])
246254

247255
self.maxDiff = None
248-
self.assertEqual(result, expected)
256+
self.assertEqual(sorted_object(result), sorted_object(expected))
249257

250258
def test_discover_not_found(self):
251259
projroot, testroot = resolve_testroot("notests")

0 commit comments

Comments
 (0)