From 14a97a8a96fede553051041dfa41e1aebb358c1b Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Tue, 22 Sep 2020 19:50:32 -0700 Subject: [PATCH 1/3] Fix object sort order in tools tests --- .../tests/testing_tools/adapter/test_functional.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pythonFiles/tests/testing_tools/adapter/test_functional.py b/pythonFiles/tests/testing_tools/adapter/test_functional.py index 86ca7275fd56..b10ac411884e 100644 --- a/pythonFiles/tests/testing_tools/adapter/test_functional.py +++ b/pythonFiles/tests/testing_tools/adapter/test_functional.py @@ -83,6 +83,14 @@ 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. @@ -160,7 +168,7 @@ 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)) @pytest.mark.skip(reason="https://github.com/microsoft/vscode-python/issues/14023") def test_discover_complex_doctest(self): @@ -245,7 +253,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") From 0ed3513468cca0c998a4de7bad3936d1a69609ca Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Wed, 23 Sep 2020 13:44:02 -0700 Subject: [PATCH 2/3] rebase with main --- pythonFiles/tests/testing_tools/adapter/test_functional.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pythonFiles/tests/testing_tools/adapter/test_functional.py b/pythonFiles/tests/testing_tools/adapter/test_functional.py index b10ac411884e..f32d588aa7f2 100644 --- a/pythonFiles/tests/testing_tools/adapter/test_functional.py +++ b/pythonFiles/tests/testing_tools/adapter/test_functional.py @@ -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 @@ -149,7 +147,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) @@ -170,7 +167,6 @@ def test_discover_complex_default(self): self.maxDiff = None self.assertEqual(sorted_object(result), sorted_object(expected)) - @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) From d3db79b06e5f4029af6e52717529877ff78c6f9d Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Wed, 23 Sep 2020 14:23:20 -0700 Subject: [PATCH 3/3] Fix formatting --- pythonFiles/tests/testing_tools/adapter/test_functional.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pythonFiles/tests/testing_tools/adapter/test_functional.py b/pythonFiles/tests/testing_tools/adapter/test_functional.py index f32d588aa7f2..153ad5508d9b 100644 --- a/pythonFiles/tests/testing_tools/adapter/test_functional.py +++ b/pythonFiles/tests/testing_tools/adapter/test_functional.py @@ -89,6 +89,7 @@ def sorted_object(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.