Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix object sort order in tools tests #14050

Merged
merged 3 commits into from
Sep 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions pythonFiles/tests/testing_tools/adapter/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import sys
import unittest

import pytest

from ...__main__ import TESTING_TOOLS_ROOT
from testing_tools.adapter.util import fix_path, PATH_SEP

Expand Down Expand Up @@ -83,6 +81,15 @@ def fix_source(tests, testid, srcfile, lineno):
test["source"] = fix_path("{}:{}".format(srcfile, lineno))


def sorted_object(obj):
if isinstance(obj, dict):
return sorted((key, sorted_object(obj[key])) for key in obj.keys())
if isinstance(obj, list):
return sorted((sorted_object(x) for x in obj))
else:
return obj


# Note that these tests are skipped if util.PATH_SEP is not os.path.sep.
# This is because the functional tests should reflect the actual
# operating environment.
Expand Down Expand Up @@ -141,7 +148,6 @@ def test_discover_simple(self):
],
)

@pytest.mark.skip(reason="https://github.com/microsoft/vscode-python/issues/14023")
def test_discover_complex_default(self):
projroot, testroot = resolve_testroot("complex")
expected = self.complex(projroot)
Expand All @@ -160,9 +166,8 @@ def test_discover_complex_default(self):
result[0]["tests"] = fix_test_order(result[0]["tests"])

self.maxDiff = None
self.assertEqual(result, expected)
self.assertEqual(sorted_object(result), sorted_object(expected))
karthiknadig marked this conversation as resolved.
Show resolved Hide resolved

@pytest.mark.skip(reason="https://github.com/microsoft/vscode-python/issues/14023")
def test_discover_complex_doctest(self):
projroot, _ = resolve_testroot("complex")
expected = self.complex(projroot)
Expand Down Expand Up @@ -245,7 +250,7 @@ def test_discover_complex_doctest(self):
result[0]["tests"] = fix_test_order(result[0]["tests"])

self.maxDiff = None
self.assertEqual(result, expected)
self.assertEqual(sorted_object(result), sorted_object(expected))

def test_discover_not_found(self):
projroot, testroot = resolve_testroot("notests")
Expand Down