forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Python test execution simple #21053
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
Merged
eleanorjboyd
merged 79 commits into
microsoft:main
from
eleanorjboyd:python-test-execution-simple
Apr 18, 2023
Merged
Python test execution simple #21053
Changes from all commits
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
f39f792
switch to using tcp for comm with server
eleanorjboyd 3e1648f
mock test changes
eleanorjboyd 32d6837
fix msgs
eleanorjboyd 6aafdc2
still working and comments in progress
eleanorjboyd a034f7b
changing to different typing
eleanorjboyd 74e3e25
fix path and docstring
eleanorjboyd 7ecb9c3
functioning test infrastructure
eleanorjboyd e867b91
switch to single expected output file
eleanorjboyd 7c5eab3
try for unittests
eleanorjboyd 9645add
refactoring and adding more .data files
eleanorjboyd 9202f3e
double and dual tests
eleanorjboyd c0e8119
cleanup
eleanorjboyd 2ea5d35
inital take on error handling
eleanorjboyd 23c3f93
parametrize
eleanorjboyd 80601d9
parametrize the tests
eleanorjboyd a74bf17
add commenting
eleanorjboyd 7757aa1
fixing paths for non local testing
eleanorjboyd de03dda
unneeded files
eleanorjboyd e28effd
attempt on http server/client
eleanorjboyd 5bd4a4a
reverting
eleanorjboyd 6f00050
add commenting, tests are passing
eleanorjboyd 7113924
fix paths to ensure all use const
eleanorjboyd b444bf1
remove local references
eleanorjboyd cf0dc3f
fixing typing, add error handling
eleanorjboyd 9af985c
comments, settings fix
eleanorjboyd 4298bb0
add doc string
eleanorjboyd 0d8ab7c
fixing formatting
eleanorjboyd 825b6b3
black formatting
eleanorjboyd 19c0280
comment noting line num
eleanorjboyd 3a69860
change to txt file
eleanorjboyd 1dc8bfc
create find line no function
eleanorjboyd d862002
line no cont
eleanorjboyd fa87708
Apply suggestions from code review from Brett
eleanorjboyd 2368f65
switch to any types to avoid private module
eleanorjboyd 026247c
current changes- broken with add for UUID
eleanorjboyd 37a4c15
pytest y, unittest n
eleanorjboyd db1467d
both unit and pytest ts working
eleanorjboyd 0f8e396
current state
eleanorjboyd 020286c
remove debug
eleanorjboyd 259102f
add jsonRPCProcessor test
eleanorjboyd 59f8592
round 2 changes
eleanorjboyd 8067b9b
round 3 edits
eleanorjboyd c5f0632
fix uneeded edits
eleanorjboyd 4b71764
small fixes
eleanorjboyd 9031162
comments and typing
eleanorjboyd 40684b6
Fix UUID unittest (#20996)
eleanorjboyd f2fe0ee
switch to using tcp for comm with server (#20981)
eleanorjboyd d759725
mock test changes
eleanorjboyd d1fd47f
add jsonRPCProcessor test
eleanorjboyd 3fc7fa0
comment out new code
eleanorjboyd 2f54b7b
removing unneeded edit
eleanorjboyd 5515b57
last few
eleanorjboyd 2546e28
remove pytest adapter tests from running rn
eleanorjboyd 218d9dc
fix pyright
eleanorjboyd 4b5ef0f
pyright
eleanorjboyd caa8586
updated a few types
eleanorjboyd 92f055a
beginning changes
eleanorjboyd d3196f8
functioning test
eleanorjboyd 7b3b088
working with 10 tests
eleanorjboyd 13207e3
fix assert errors and add tests execution
eleanorjboyd f4c0903
fix pyright
eleanorjboyd 810cb74
fix package calling
eleanorjboyd a5ee8b1
Attempt to fix the connection error issue.
karthiknadig 5551f5d
Try winsock reset
karthiknadig b158853
Revert "Try winsock reset"
karthiknadig e56a02f
Try with shell execute
karthiknadig 0e90726
Revert "Try with shell execute"
karthiknadig 952d3f3
Fix pathing for windows
karthiknadig 8692100
Try running all python tests without deps
karthiknadig 015eec1
Ensure proper env use.
karthiknadig dc856be
fix launch path for pytest debug
eleanorjboyd 9ec5990
fix error
eleanorjboyd 4533999
fix duplicate
eleanorjboyd 246e98b
remove dup code
eleanorjboyd 132f54a
dup test
eleanorjboyd 9d20000
incorrect doc string
eleanorjboyd b1464ae
fix failing tests
eleanorjboyd 8ee468b
fix pyright errors
eleanorjboyd a58a637
Update pythonFiles/tests/pytestadapter/.data/unittest_folder/test_sub…
eleanorjboyd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
328 changes: 328 additions & 0 deletions
328
pythonFiles/tests/pytestadapter/expected_execution_test_output.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,328 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
TEST_SUBTRACT_FUNCTION = "unittest_folder/test_subtract.py::TestSubtractFunction::" | ||
TEST_ADD_FUNCTION = "unittest_folder/test_add.py::TestAddFunction::" | ||
SUCCESS = "success" | ||
FAILURE = "failure" | ||
TEST_SUBTRACT_FUNCTION_NEGATIVE_NUMBERS_ERROR = "self = <test_subtract.TestSubtractFunction testMethod=test_subtract_negative_numbers>\n\n def test_subtract_negative_numbers( # test_marker--test_subtract_negative_numbers\n self,\n ):\n result = subtract(-2, -3)\n> self.assertEqual(result, 100000)\nE AssertionError: 1 != 100000\n\nunittest_folder/test_subtract.py:25: AssertionError" | ||
|
||
# This is the expected output for the unittest_folder execute tests | ||
# └── unittest_folder | ||
# ├── test_add.py | ||
# │ └── TestAddFunction | ||
# │ ├── test_add_negative_numbers: success | ||
# │ └── test_add_positive_numbers: success | ||
# └── test_subtract.py | ||
# └── TestSubtractFunction | ||
# ├── test_subtract_negative_numbers: failure | ||
# └── test_subtract_positive_numbers: success | ||
uf_execution_expected_output = { | ||
f"{TEST_ADD_FUNCTION}test_add_negative_numbers": { | ||
"test": f"{TEST_ADD_FUNCTION}test_add_negative_numbers", | ||
"outcome": SUCCESS, | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
f"{TEST_ADD_FUNCTION}test_add_positive_numbers": { | ||
"test": f"{TEST_ADD_FUNCTION}test_add_positive_numbers", | ||
"outcome": SUCCESS, | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
f"{TEST_SUBTRACT_FUNCTION}test_subtract_negative_numbers": { | ||
"test": f"{TEST_SUBTRACT_FUNCTION}test_subtract_negative_numbers", | ||
"outcome": FAILURE, | ||
"message": "ERROR MESSAGE", | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
f"{TEST_SUBTRACT_FUNCTION}test_subtract_positive_numbers": { | ||
"test": f"{TEST_SUBTRACT_FUNCTION}test_subtract_positive_numbers", | ||
"outcome": SUCCESS, | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
} | ||
|
||
|
||
# This is the expected output for the unittest_folder only execute add.py tests | ||
# └── unittest_folder | ||
# ├── test_add.py | ||
# │ └── TestAddFunction | ||
# │ ├── test_add_negative_numbers: success | ||
# │ └── test_add_positive_numbers: success | ||
uf_single_file_expected_output = { | ||
f"{TEST_ADD_FUNCTION}test_add_negative_numbers": { | ||
"test": f"{TEST_ADD_FUNCTION}test_add_negative_numbers", | ||
"outcome": SUCCESS, | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
f"{TEST_ADD_FUNCTION}test_add_positive_numbers": { | ||
"test": f"{TEST_ADD_FUNCTION}test_add_positive_numbers", | ||
"outcome": SUCCESS, | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
} | ||
|
||
# This is the expected output for the unittest_folder execute only signle method | ||
# └── unittest_folder | ||
# ├── test_add.py | ||
# │ └── TestAddFunction | ||
# │ └── test_add_positive_numbers: success | ||
uf_single_method_execution_expected_output = { | ||
f"{TEST_ADD_FUNCTION}test_add_positive_numbers": { | ||
"test": f"{TEST_ADD_FUNCTION}test_add_positive_numbers", | ||
"outcome": SUCCESS, | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
} | ||
} | ||
|
||
# This is the expected output for the unittest_folder tests run where two tests | ||
# run are in different files. | ||
# └── unittest_folder | ||
# ├── test_add.py | ||
# │ └── TestAddFunction | ||
# │ └── test_add_positive_numbers: success | ||
# └── test_subtract.py | ||
# └── TestSubtractFunction | ||
# └── test_subtract_positive_numbers: success | ||
uf_non_adjacent_tests_execution_expected_output = { | ||
TEST_SUBTRACT_FUNCTION | ||
+ "test_subtract_positive_numbers": { | ||
"test": TEST_SUBTRACT_FUNCTION + "test_subtract_positive_numbers", | ||
"outcome": SUCCESS, | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
TEST_ADD_FUNCTION | ||
+ "test_add_positive_numbers": { | ||
"test": TEST_ADD_FUNCTION + "test_add_positive_numbers", | ||
"outcome": SUCCESS, | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
} | ||
|
||
# This is the expected output for the simple_pytest.py file. | ||
# └── simple_pytest.py | ||
# └── test_function: success | ||
simple_execution_pytest_expected_output = { | ||
"simple_pytest.py::test_function": { | ||
"test": "simple_pytest.py::test_function", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
} | ||
} | ||
|
||
# This is the expected output for the unittest_pytest_same_file.py file. | ||
# ├── unittest_pytest_same_file.py | ||
# ├── TestExample | ||
# │ └── test_true_unittest: success | ||
# └── test_true_pytest: success | ||
unit_pytest_same_file_execution_expected_output = { | ||
"unittest_pytest_same_file.py::TestExample::test_true_unittest": { | ||
"test": "unittest_pytest_same_file.py::TestExample::test_true_unittest", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"unittest_pytest_same_file.py::test_true_pytest": { | ||
"test": "unittest_pytest_same_file.py::test_true_pytest", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
} | ||
|
||
# This is the expected output for the dual_level_nested_folder.py tests | ||
# └── dual_level_nested_folder | ||
# └── test_top_folder.py | ||
# └── test_top_function_t: success | ||
# └── test_top_function_f: failure | ||
# └── nested_folder_one | ||
# └── test_bottom_folder.py | ||
# └── test_bottom_function_t: success | ||
# └── test_bottom_function_f: failure | ||
dual_level_nested_folder_execution_expected_output = { | ||
"dual_level_nested_folder/test_top_folder.py::test_top_function_t": { | ||
"test": "dual_level_nested_folder/test_top_folder.py::test_top_function_t", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"dual_level_nested_folder/test_top_folder.py::test_top_function_f": { | ||
"test": "dual_level_nested_folder/test_top_folder.py::test_top_function_f", | ||
"outcome": "failure", | ||
"message": "ERROR MESSAGE", | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_t": { | ||
"test": "dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_t", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_f": { | ||
"test": "dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_f", | ||
"outcome": "failure", | ||
"message": "ERROR MESSAGE", | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
} | ||
|
||
# This is the expected output for the nested_folder tests. | ||
# └── nested_folder_one | ||
# └── nested_folder_two | ||
# └── test_nest.py | ||
# └── test_function: success | ||
double_nested_folder_expected_execution_output = { | ||
"double_nested_folder/nested_folder_one/nested_folder_two/test_nest.py::test_function": { | ||
"test": "double_nested_folder/nested_folder_one/nested_folder_two/test_nest.py::test_function", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
} | ||
} | ||
|
||
# This is the expected output for the nested_folder tests. | ||
# └── parametrize_tests.py | ||
# └── test_adding[3+5-8]: success | ||
# └── test_adding[2+4-6]: success | ||
# └── test_adding[6+9-16]: failure | ||
parametrize_tests_expected_execution_output = { | ||
"parametrize_tests.py::test_adding[3+5-8]": { | ||
"test": "parametrize_tests.py::test_adding[3+5-8]", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"parametrize_tests.py::test_adding[2+4-6]": { | ||
"test": "parametrize_tests.py::test_adding[2+4-6]", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"parametrize_tests.py::test_adding[6+9-16]": { | ||
"test": "parametrize_tests.py::test_adding[6+9-16]", | ||
"outcome": "failure", | ||
"message": "ERROR MESSAGE", | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
} | ||
|
||
# This is the expected output for the single parameterized tests. | ||
# └── parametrize_tests.py | ||
# └── test_adding[3+5-8]: success | ||
single_parametrize_tests_expected_execution_output = { | ||
"parametrize_tests.py::test_adding[3+5-8]": { | ||
"test": "parametrize_tests.py::test_adding[3+5-8]", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
} | ||
|
||
# This is the expected output for the single parameterized tests. | ||
# └── text_docstring.txt | ||
# └── text_docstring: success | ||
doctest_pytest_expected_execution_output = { | ||
"text_docstring.txt::text_docstring.txt": { | ||
"test": "text_docstring.txt::text_docstring.txt", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
} | ||
} | ||
|
||
# Will run all tests in the cwd that fit the test file naming pattern. | ||
no_test_ids_pytest_execution_expected_output = { | ||
"double_nested_folder/nested_folder_one/nested_folder_two/test_nest.py::test_function": { | ||
"test": "double_nested_folder/nested_folder_one/nested_folder_two/test_nest.py::test_function", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"dual_level_nested_folder/test_top_folder.py::test_top_function_t": { | ||
"test": "dual_level_nested_folder/test_top_folder.py::test_top_function_t", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"dual_level_nested_folder/test_top_folder.py::test_top_function_f": { | ||
"test": "dual_level_nested_folder/test_top_folder.py::test_top_function_f", | ||
"outcome": "failure", | ||
"message": "ERROR MESSAGE", | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_t": { | ||
"test": "dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_t", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_f": { | ||
"test": "dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_f", | ||
"outcome": "failure", | ||
"message": "ERROR MESSAGE", | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"unittest_folder/test_add.py::TestAddFunction::test_add_negative_numbers": { | ||
"test": "unittest_folder/test_add.py::TestAddFunction::test_add_negative_numbers", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"unittest_folder/test_add.py::TestAddFunction::test_add_positive_numbers": { | ||
"test": "unittest_folder/test_add.py::TestAddFunction::test_add_positive_numbers", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"unittest_folder/test_subtract.py::TestSubtractFunction::test_subtract_negative_numbers": { | ||
"test": "unittest_folder/test_subtract.py::TestSubtractFunction::test_subtract_negative_numbers", | ||
"outcome": "failure", | ||
"message": "ERROR MESSAGE", | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
"unittest_folder/test_subtract.py::TestSubtractFunction::test_subtract_positive_numbers": { | ||
"test": "unittest_folder/test_subtract.py::TestSubtractFunction::test_subtract_positive_numbers", | ||
"outcome": "success", | ||
"message": None, | ||
"traceback": None, | ||
"subtest": None, | ||
}, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.