@@ -83,6 +83,14 @@ def fix_source(tests, testid, srcfile, lineno):
83
83
test ["source" ] = fix_path ("{}:{}" .format (srcfile , lineno ))
84
84
85
85
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
+
86
94
# Note that these tests are skipped if util.PATH_SEP is not os.path.sep.
87
95
# This is because the functional tests should reflect the actual
88
96
# operating environment.
@@ -160,7 +168,7 @@ def test_discover_complex_default(self):
160
168
result [0 ]["tests" ] = fix_test_order (result [0 ]["tests" ])
161
169
162
170
self .maxDiff = None
163
- self .assertEqual (result , expected )
171
+ self .assertEqual (sorted_object ( result ), sorted_object ( expected ) )
164
172
165
173
@pytest .mark .skip (reason = "https://github.com/microsoft/vscode-python/issues/14023" )
166
174
def test_discover_complex_doctest (self ):
@@ -245,7 +253,7 @@ def test_discover_complex_doctest(self):
245
253
result [0 ]["tests" ] = fix_test_order (result [0 ]["tests" ])
246
254
247
255
self .maxDiff = None
248
- self .assertEqual (result , expected )
256
+ self .assertEqual (sorted_object ( result ), sorted_object ( expected ) )
249
257
250
258
def test_discover_not_found (self ):
251
259
projroot , testroot = resolve_testroot ("notests" )
0 commit comments