From ec782674e2670b34e9f481ee5171264e573cd5cf Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 12 Aug 2019 14:14:49 -0600 Subject: [PATCH 1/3] Fix functional extension tests for pytest. --- .../testing/pytest/pytest.discovery.test.ts | 101 ++++++++++++++++-- 1 file changed, 90 insertions(+), 11 deletions(-) diff --git a/src/test/testing/pytest/pytest.discovery.test.ts b/src/test/testing/pytest/pytest.discovery.test.ts index 3f9e3dc021ad..b2539580879e 100644 --- a/src/test/testing/pytest/pytest.discovery.test.ts +++ b/src/test/testing/pytest/pytest.discovery.test.ts @@ -95,19 +95,83 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { rootid: '.', root: '/Users/donjayamanne/.vscode-insiders/extensions/pythonVSCode/src/test/pythonFiles/testFiles/single', parents: [ - { id: './test_root.py', kind: 'file', name: 'test_root.py', parentid: '.' }, - { id: './test_root.py::Test_Root_test1', kind: 'suite', name: 'Test_Root_test1', parentid: './test_root.py' }, - { id: './tests', kind: 'folder', name: 'tests', parentid: '.' }, - { id: './tests/test_one.py', kind: 'file', name: 'test_one.py', parentid: './tests' }, - { id: './tests/test_one.py::Test_test1', kind: 'suite', name: 'Test_test1', parentid: './tests/test_one.py' } + { + id: './test_root.py', + kind: 'file', + name: 'test_root.py', + relpath: './test_root.py', + parentid: '.' + }, + { + id: './test_root.py::Test_Root_test1', + kind: 'suite', + name: 'Test_Root_test1', + parentid: './test_root.py' + }, + { + id: './tests', + kind: 'folder', + name: 'tests', + relpath: './tests', + parentid: '.' + }, + { + id: './tests/test_one.py', + kind: 'file', + name: 'test_one.py', + relpath: './tests/test_one.py', + parentid: './tests' + }, + { + id: './tests/test_one.py::Test_test1', + kind: 'suite', + name: 'Test_test1', + parentid: './tests/test_one.py' + } ], tests: [ - { id: './test_root.py::Test_Root_test1::test_Root_A', name: 'test_Root_A', source: './test_root.py:6', markers: [], parentid: './test_root.py::Test_Root_test1' }, - { id: './test_root.py::Test_Root_test1::test_Root_B', name: 'test_Root_B', source: './test_root.py:9', markers: [], parentid: './test_root.py::Test_Root_test1' }, - { id: './test_root.py::Test_Root_test1::test_Root_c', name: 'test_Root_c', source: './test_root.py:12', markers: [], parentid: './test_root.py::Test_Root_test1' }, - { id: './tests/test_one.py::Test_test1::test_A', name: 'test_A', source: 'tests/test_one.py:6', markers: [], parentid: './tests/test_one.py::Test_test1' }, - { id: './tests/test_one.py::Test_test1::test_B', name: 'test_B', source: 'tests/test_one.py:9', markers: [], parentid: './tests/test_one.py::Test_test1' }, - { id: './tests/test_one.py::Test_test1::test_c', name: 'test_c', source: 'tests/test_one.py:12', markers: [], parentid: './tests/test_one.py::Test_test1' } + { + id: './test_root.py::Test_Root_test1::test_Root_A', + name: 'test_Root_A', + source: './test_root.py:6', + markers: [], + parentid: './test_root.py::Test_Root_test1' + }, + { + id: './test_root.py::Test_Root_test1::test_Root_B', + name: 'test_Root_B', + source: './test_root.py:9', + markers: [], + parentid: './test_root.py::Test_Root_test1' + }, + { + id: './test_root.py::Test_Root_test1::test_Root_c', + name: 'test_Root_c', + source: './test_root.py:12', + markers: [], + parentid: './test_root.py::Test_Root_test1' + }, + { + id: './tests/test_one.py::Test_test1::test_A', + name: 'test_A', + source: 'tests/test_one.py:6', + markers: [], + parentid: './tests/test_one.py::Test_test1' + }, + { + id: './tests/test_one.py::Test_test1::test_B', + name: 'test_B', + source: 'tests/test_one.py:9', + markers: [], + parentid: './tests/test_one.py::Test_test1' + }, + { + id: './tests/test_one.py::Test_test1::test_c', + name: 'test_c', + source: 'tests/test_one.py:12', + markers: [], + parentid: './tests/test_one.py::Test_test1' + } ] }])); const factory = ioc.serviceContainer.get(ITestManagerFactory); @@ -132,6 +196,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { parents: [ { id: './test_root.py', + relpath: './test_root.py', kind: 'file', name: 'test_root.py', parentid: '.' @@ -144,12 +209,14 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { }, { id: './tests', + relpath: './tests', kind: 'folder', name: 'tests', parentid: '.' }, { id: './tests/test_another_pytest.py', + relpath: './tests/test_another_pytest.py', kind: 'file', name: 'test_another_pytest.py', parentid: './tests' @@ -162,6 +229,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { }, { id: './tests/test_foreign_nested_tests.py', + relpath: './tests/test_foreign_nested_tests.py', kind: 'file', name: 'test_foreign_nested_tests.py', parentid: './tests' @@ -186,6 +254,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { }, { id: './tests/test_pytest.py', + relpath: './tests/test_pytest.py', kind: 'file', name: 'test_pytest.py', parentid: './tests' @@ -216,6 +285,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { }, { id: './tests/test_unittest_one.py', + relpath: './tests/test_unittest_one.py', kind: 'file', name: 'test_unittest_one.py', parentid: './tests' @@ -228,6 +298,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { }, { id: './tests/test_unittest_two.py', + relpath: './tests/test_unittest_two.py', kind: 'file', name: 'test_unittest_two.py', parentid: './tests' @@ -246,6 +317,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { }, { id: './tests/unittest_three_test.py', + relpath: './tests/unittest_three_test.py', kind: 'file', name: 'unittest_three_test.py', parentid: './tests' @@ -523,12 +595,14 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { id: './tests', kind: 'folder', name: 'tests', + relpath: './tests', parentid: '.' }, { id: './tests/unittest_three_test.py', kind: 'file', name: 'unittest_three_test.py', + relpath: './tests/unittest_three_test.py', parentid: './tests' }, { @@ -580,12 +654,14 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { parents: [ { id: './other', + relpath: './other', kind: 'folder', name: 'other', parentid: '.' }, { id: './other/test_pytest.py', + relpath: './other/test_pytest.py', kind: 'file', name: 'test_pytest.py', parentid: './other' @@ -616,6 +692,7 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { }, { id: './other/test_unittest_one.py', + relpath: './other/test_unittest_one.py', kind: 'file', name: 'test_unittest_one.py', parentid: './other' @@ -756,12 +833,14 @@ suite('Unit Tests - pytest - discovery with mocked process output', () => { id: './tests', kind: 'folder', name: 'tests', + relpath: './tests', parentid: '.' }, { id: './tests/test_cwd.py', kind: 'file', name: 'test_cwd.py', + relpath: './tests/test_cwd.py', parentid: './tests' }, { From 5ff2f946c0ec9708cb5d99f3169c9f4bf4ee0a39 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 12 Aug 2019 14:18:05 -0600 Subject: [PATCH 2/3] Add a NEWS entry. --- news/2 Fixes/6940.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2 Fixes/6940.md diff --git a/news/2 Fixes/6940.md b/news/2 Fixes/6940.md new file mode 100644 index 000000000000..be1445749588 --- /dev/null +++ b/news/2 Fixes/6940.md @@ -0,0 +1 @@ +Fix failing functional tests (for pytest) in the extension. From 71139da0a901883d30b82a242b648b7ffdb21643 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 12 Aug 2019 15:06:37 -0600 Subject: [PATCH 3/3] Fix pytest data files for functional discovery tests. --- .../testFiles/pytestFiles/results/five.output | 26 ++++++++++++------- .../testFiles/pytestFiles/results/four.output | 26 ++++++++++++------- .../testFiles/pytestFiles/results/one.output | 26 ++++++++++++------- .../pytestFiles/results/three.output | 26 ++++++++++++------- .../testFiles/pytestFiles/results/two.output | 26 ++++++++++++------- 5 files changed, 85 insertions(+), 45 deletions(-) diff --git a/src/test/pythonFiles/testFiles/pytestFiles/results/five.output b/src/test/pythonFiles/testFiles/pytestFiles/results/five.output index 125a1d107372..c7b9d058f784 100644 --- a/src/test/pythonFiles/testFiles/pytestFiles/results/five.output +++ b/src/test/pythonFiles/testFiles/pytestFiles/results/five.output @@ -7,7 +7,8 @@ "id": "./test_root.py", "kind": "file", "name": "test_root.py", - "parentid": "." + "parentid": ".", + "relpath": "./test_root.py" }, { "id": "./test_root.py::Test_Root_test1", @@ -19,13 +20,15 @@ "id": "./tests", "kind": "folder", "name": "tests", - "parentid": "." + "parentid": ".", + "relpath": "./tests" }, { "id": "./tests/test_another_pytest.py", "kind": "file", "name": "test_another_pytest.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_another_pytest.py" }, { "id": "./tests/test_another_pytest.py::test_parametrized_username", @@ -37,7 +40,8 @@ "id": "./tests/test_foreign_nested_tests.py", "kind": "file", "name": "test_foreign_nested_tests.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_foreign_nested_tests.py" }, { "id": "./tests/test_foreign_nested_tests.py::TestNestedForeignTests", @@ -61,7 +65,8 @@ "id": "./tests/test_pytest.py", "kind": "file", "name": "test_pytest.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_pytest.py" }, { "id": "./tests/test_pytest.py::Test_CheckMyApp", @@ -91,7 +96,8 @@ "id": "./tests/test_unittest_one.py", "kind": "file", "name": "test_unittest_one.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_unittest_one.py" }, { "id": "./tests/test_unittest_one.py::Test_test1", @@ -103,7 +109,8 @@ "id": "./tests/test_unittest_two.py", "kind": "file", "name": "test_unittest_two.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_unittest_two.py" }, { "id": "./tests/test_unittest_two.py::Test_test2", @@ -121,7 +128,8 @@ "id": "./tests/unittest_three_test.py", "kind": "file", "name": "unittest_three_test.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/unittest_three_test.py" }, { "id": "./tests/unittest_three_test.py::Test_test3", @@ -364,4 +372,4 @@ } ] } -] +] \ No newline at end of file diff --git a/src/test/pythonFiles/testFiles/pytestFiles/results/four.output b/src/test/pythonFiles/testFiles/pytestFiles/results/four.output index 125a1d107372..c7b9d058f784 100644 --- a/src/test/pythonFiles/testFiles/pytestFiles/results/four.output +++ b/src/test/pythonFiles/testFiles/pytestFiles/results/four.output @@ -7,7 +7,8 @@ "id": "./test_root.py", "kind": "file", "name": "test_root.py", - "parentid": "." + "parentid": ".", + "relpath": "./test_root.py" }, { "id": "./test_root.py::Test_Root_test1", @@ -19,13 +20,15 @@ "id": "./tests", "kind": "folder", "name": "tests", - "parentid": "." + "parentid": ".", + "relpath": "./tests" }, { "id": "./tests/test_another_pytest.py", "kind": "file", "name": "test_another_pytest.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_another_pytest.py" }, { "id": "./tests/test_another_pytest.py::test_parametrized_username", @@ -37,7 +40,8 @@ "id": "./tests/test_foreign_nested_tests.py", "kind": "file", "name": "test_foreign_nested_tests.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_foreign_nested_tests.py" }, { "id": "./tests/test_foreign_nested_tests.py::TestNestedForeignTests", @@ -61,7 +65,8 @@ "id": "./tests/test_pytest.py", "kind": "file", "name": "test_pytest.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_pytest.py" }, { "id": "./tests/test_pytest.py::Test_CheckMyApp", @@ -91,7 +96,8 @@ "id": "./tests/test_unittest_one.py", "kind": "file", "name": "test_unittest_one.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_unittest_one.py" }, { "id": "./tests/test_unittest_one.py::Test_test1", @@ -103,7 +109,8 @@ "id": "./tests/test_unittest_two.py", "kind": "file", "name": "test_unittest_two.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_unittest_two.py" }, { "id": "./tests/test_unittest_two.py::Test_test2", @@ -121,7 +128,8 @@ "id": "./tests/unittest_three_test.py", "kind": "file", "name": "unittest_three_test.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/unittest_three_test.py" }, { "id": "./tests/unittest_three_test.py::Test_test3", @@ -364,4 +372,4 @@ } ] } -] +] \ No newline at end of file diff --git a/src/test/pythonFiles/testFiles/pytestFiles/results/one.output b/src/test/pythonFiles/testFiles/pytestFiles/results/one.output index 125a1d107372..c7b9d058f784 100644 --- a/src/test/pythonFiles/testFiles/pytestFiles/results/one.output +++ b/src/test/pythonFiles/testFiles/pytestFiles/results/one.output @@ -7,7 +7,8 @@ "id": "./test_root.py", "kind": "file", "name": "test_root.py", - "parentid": "." + "parentid": ".", + "relpath": "./test_root.py" }, { "id": "./test_root.py::Test_Root_test1", @@ -19,13 +20,15 @@ "id": "./tests", "kind": "folder", "name": "tests", - "parentid": "." + "parentid": ".", + "relpath": "./tests" }, { "id": "./tests/test_another_pytest.py", "kind": "file", "name": "test_another_pytest.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_another_pytest.py" }, { "id": "./tests/test_another_pytest.py::test_parametrized_username", @@ -37,7 +40,8 @@ "id": "./tests/test_foreign_nested_tests.py", "kind": "file", "name": "test_foreign_nested_tests.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_foreign_nested_tests.py" }, { "id": "./tests/test_foreign_nested_tests.py::TestNestedForeignTests", @@ -61,7 +65,8 @@ "id": "./tests/test_pytest.py", "kind": "file", "name": "test_pytest.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_pytest.py" }, { "id": "./tests/test_pytest.py::Test_CheckMyApp", @@ -91,7 +96,8 @@ "id": "./tests/test_unittest_one.py", "kind": "file", "name": "test_unittest_one.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_unittest_one.py" }, { "id": "./tests/test_unittest_one.py::Test_test1", @@ -103,7 +109,8 @@ "id": "./tests/test_unittest_two.py", "kind": "file", "name": "test_unittest_two.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_unittest_two.py" }, { "id": "./tests/test_unittest_two.py::Test_test2", @@ -121,7 +128,8 @@ "id": "./tests/unittest_three_test.py", "kind": "file", "name": "unittest_three_test.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/unittest_three_test.py" }, { "id": "./tests/unittest_three_test.py::Test_test3", @@ -364,4 +372,4 @@ } ] } -] +] \ No newline at end of file diff --git a/src/test/pythonFiles/testFiles/pytestFiles/results/three.output b/src/test/pythonFiles/testFiles/pytestFiles/results/three.output index 125a1d107372..c7b9d058f784 100644 --- a/src/test/pythonFiles/testFiles/pytestFiles/results/three.output +++ b/src/test/pythonFiles/testFiles/pytestFiles/results/three.output @@ -7,7 +7,8 @@ "id": "./test_root.py", "kind": "file", "name": "test_root.py", - "parentid": "." + "parentid": ".", + "relpath": "./test_root.py" }, { "id": "./test_root.py::Test_Root_test1", @@ -19,13 +20,15 @@ "id": "./tests", "kind": "folder", "name": "tests", - "parentid": "." + "parentid": ".", + "relpath": "./tests" }, { "id": "./tests/test_another_pytest.py", "kind": "file", "name": "test_another_pytest.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_another_pytest.py" }, { "id": "./tests/test_another_pytest.py::test_parametrized_username", @@ -37,7 +40,8 @@ "id": "./tests/test_foreign_nested_tests.py", "kind": "file", "name": "test_foreign_nested_tests.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_foreign_nested_tests.py" }, { "id": "./tests/test_foreign_nested_tests.py::TestNestedForeignTests", @@ -61,7 +65,8 @@ "id": "./tests/test_pytest.py", "kind": "file", "name": "test_pytest.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_pytest.py" }, { "id": "./tests/test_pytest.py::Test_CheckMyApp", @@ -91,7 +96,8 @@ "id": "./tests/test_unittest_one.py", "kind": "file", "name": "test_unittest_one.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_unittest_one.py" }, { "id": "./tests/test_unittest_one.py::Test_test1", @@ -103,7 +109,8 @@ "id": "./tests/test_unittest_two.py", "kind": "file", "name": "test_unittest_two.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_unittest_two.py" }, { "id": "./tests/test_unittest_two.py::Test_test2", @@ -121,7 +128,8 @@ "id": "./tests/unittest_three_test.py", "kind": "file", "name": "unittest_three_test.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/unittest_three_test.py" }, { "id": "./tests/unittest_three_test.py::Test_test3", @@ -364,4 +372,4 @@ } ] } -] +] \ No newline at end of file diff --git a/src/test/pythonFiles/testFiles/pytestFiles/results/two.output b/src/test/pythonFiles/testFiles/pytestFiles/results/two.output index 125a1d107372..c7b9d058f784 100644 --- a/src/test/pythonFiles/testFiles/pytestFiles/results/two.output +++ b/src/test/pythonFiles/testFiles/pytestFiles/results/two.output @@ -7,7 +7,8 @@ "id": "./test_root.py", "kind": "file", "name": "test_root.py", - "parentid": "." + "parentid": ".", + "relpath": "./test_root.py" }, { "id": "./test_root.py::Test_Root_test1", @@ -19,13 +20,15 @@ "id": "./tests", "kind": "folder", "name": "tests", - "parentid": "." + "parentid": ".", + "relpath": "./tests" }, { "id": "./tests/test_another_pytest.py", "kind": "file", "name": "test_another_pytest.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_another_pytest.py" }, { "id": "./tests/test_another_pytest.py::test_parametrized_username", @@ -37,7 +40,8 @@ "id": "./tests/test_foreign_nested_tests.py", "kind": "file", "name": "test_foreign_nested_tests.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_foreign_nested_tests.py" }, { "id": "./tests/test_foreign_nested_tests.py::TestNestedForeignTests", @@ -61,7 +65,8 @@ "id": "./tests/test_pytest.py", "kind": "file", "name": "test_pytest.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_pytest.py" }, { "id": "./tests/test_pytest.py::Test_CheckMyApp", @@ -91,7 +96,8 @@ "id": "./tests/test_unittest_one.py", "kind": "file", "name": "test_unittest_one.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_unittest_one.py" }, { "id": "./tests/test_unittest_one.py::Test_test1", @@ -103,7 +109,8 @@ "id": "./tests/test_unittest_two.py", "kind": "file", "name": "test_unittest_two.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/test_unittest_two.py" }, { "id": "./tests/test_unittest_two.py::Test_test2", @@ -121,7 +128,8 @@ "id": "./tests/unittest_three_test.py", "kind": "file", "name": "unittest_three_test.py", - "parentid": "./tests" + "parentid": "./tests", + "relpath": "./tests/unittest_three_test.py" }, { "id": "./tests/unittest_three_test.py::Test_test3", @@ -364,4 +372,4 @@ } ] } -] +] \ No newline at end of file