forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
test discovery 2.0 #25760
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 29 commits into
microsoft:test-project-support
from
eleanorjboyd:instant-eagle-2
Feb 6, 2026
Merged
test discovery 2.0 #25760
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
ad3ae47
Checkpoint from VS Code for cloud agent session
eleanorjboyd 7af8ea3
Phase 1: Add core infrastructure for project-based testing
Copilot 460faa8
Phase 2: Add project discovery integration
Copilot b670e8e
Update activate() to support project-based testing
Copilot 8e13f1d
updates
eleanorjboyd 133d97e
formatting
eleanorjboyd aba0183
remove doc on design
eleanorjboyd 61745de
remove unneeded
eleanorjboyd 3b7cbf9
adding tests for helpers
eleanorjboyd cf2e75c
testing and refinement
eleanorjboyd 28b34dc
tests for controller
eleanorjboyd 7b81f07
separators and update api calls
eleanorjboyd b2a3a8e
checkpoint- project test nodes
eleanorjboyd 45675a4
second checkpoint- ignore implemented
eleanorjboyd 267007b
cleanup cleanup everybody everywhere
eleanorjboyd 2abfbbe
remove comments
eleanorjboyd 4e7a325
refinement
eleanorjboyd 225ff12
remove unittest refs
eleanorjboyd 29533cf
cleanup
eleanorjboyd ca14068
pytest tests
eleanorjboyd 34965e3
test fixes
eleanorjboyd 7c3c879
fix
eleanorjboyd 42cd011
address comments
eleanorjboyd 145ccc8
fixes
eleanorjboyd ef32ac2
testing logging
eleanorjboyd b4563cd
test fix
eleanorjboyd d472e4b
remove unneeded edits
eleanorjboyd 0718994
lots of fun fixes
eleanorjboyd 9050b23
fix
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
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 |
|---|---|---|
|
|
@@ -1870,3 +1870,214 @@ | |
| ], | ||
| "id_": TEST_DATA_PATH_STR, | ||
| } | ||
|
|
||
| # ===================================================================================== | ||
| # PROJECT_ROOT_PATH environment variable tests | ||
| # These test the project-based testing feature where PROJECT_ROOT_PATH changes | ||
| # the test tree root from cwd to the specified project path. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in the diagram- outline where the projects are configured in this setup |
||
| # ===================================================================================== | ||
|
|
||
| # This is the expected output for unittest_folder when PROJECT_ROOT_PATH is set to unittest_folder. | ||
| # The root of the tree is unittest_folder (not .data), simulating project-based testing. | ||
| # | ||
| # **Project Configuration:** | ||
| # In the VS Code Python extension, projects are defined by the Python Environments extension. | ||
| # Each project has a root directory (identified by pyproject.toml, setup.py, etc.). | ||
| # When PROJECT_ROOT_PATH is set, pytest uses that path as the test tree root instead of cwd. | ||
| # | ||
| # **Test Tree Structure:** | ||
| # Without PROJECT_ROOT_PATH (legacy mode): | ||
| # └── .data (cwd = workspace root) | ||
| # └── unittest_folder | ||
| # └── test_add.py, test_subtract.py... | ||
| # | ||
| # With PROJECT_ROOT_PATH set to unittest_folder (project-based mode): | ||
| # └── unittest_folder (ROOT - set via PROJECT_ROOT_PATH env var) | ||
| # ├── test_add.py | ||
| # │ └── TestAddFunction | ||
| # │ ├── test_add_negative_numbers | ||
| # │ └── test_add_positive_numbers | ||
| # │ └── TestDuplicateFunction | ||
| # │ └── test_dup_a | ||
| # └── test_subtract.py | ||
| # └── TestSubtractFunction | ||
| # ├── test_subtract_negative_numbers | ||
| # └── test_subtract_positive_numbers | ||
| # └── TestDuplicateFunction | ||
| # └── test_dup_s | ||
| # | ||
| # Note: This reuses the unittest_folder paths defined earlier in this file. | ||
| project_root_unittest_folder_expected_output = { | ||
| "name": "unittest_folder", | ||
| "path": os.fspath(unittest_folder_path), | ||
| "type_": "folder", | ||
| "children": [ | ||
| { | ||
| "name": "test_add.py", | ||
| "path": os.fspath(test_add_path), | ||
| "type_": "file", | ||
| "id_": os.fspath(test_add_path), | ||
| "children": [ | ||
| { | ||
| "name": "TestAddFunction", | ||
| "path": os.fspath(test_add_path), | ||
| "type_": "class", | ||
| "children": [ | ||
| { | ||
| "name": "test_add_negative_numbers", | ||
| "path": os.fspath(test_add_path), | ||
| "lineno": find_test_line_number( | ||
| "test_add_negative_numbers", | ||
| os.fspath(test_add_path), | ||
| ), | ||
| "type_": "test", | ||
| "id_": get_absolute_test_id( | ||
| "test_add.py::TestAddFunction::test_add_negative_numbers", | ||
| test_add_path, | ||
| ), | ||
| "runID": get_absolute_test_id( | ||
| "test_add.py::TestAddFunction::test_add_negative_numbers", | ||
| test_add_path, | ||
| ), | ||
| }, | ||
| { | ||
| "name": "test_add_positive_numbers", | ||
| "path": os.fspath(test_add_path), | ||
| "lineno": find_test_line_number( | ||
| "test_add_positive_numbers", | ||
| os.fspath(test_add_path), | ||
| ), | ||
| "type_": "test", | ||
| "id_": get_absolute_test_id( | ||
| "test_add.py::TestAddFunction::test_add_positive_numbers", | ||
| test_add_path, | ||
| ), | ||
| "runID": get_absolute_test_id( | ||
| "test_add.py::TestAddFunction::test_add_positive_numbers", | ||
| test_add_path, | ||
| ), | ||
| }, | ||
| ], | ||
| "id_": get_absolute_test_id( | ||
| "test_add.py::TestAddFunction", | ||
| test_add_path, | ||
| ), | ||
| "lineno": find_class_line_number("TestAddFunction", test_add_path), | ||
| }, | ||
| { | ||
| "name": "TestDuplicateFunction", | ||
| "path": os.fspath(test_add_path), | ||
| "type_": "class", | ||
| "children": [ | ||
| { | ||
| "name": "test_dup_a", | ||
| "path": os.fspath(test_add_path), | ||
| "lineno": find_test_line_number( | ||
| "test_dup_a", | ||
| os.fspath(test_add_path), | ||
| ), | ||
| "type_": "test", | ||
| "id_": get_absolute_test_id( | ||
| "test_add.py::TestDuplicateFunction::test_dup_a", | ||
| test_add_path, | ||
| ), | ||
| "runID": get_absolute_test_id( | ||
| "test_add.py::TestDuplicateFunction::test_dup_a", | ||
| test_add_path, | ||
| ), | ||
| }, | ||
| ], | ||
| "id_": get_absolute_test_id( | ||
| "test_add.py::TestDuplicateFunction", | ||
| test_add_path, | ||
| ), | ||
| "lineno": find_class_line_number("TestDuplicateFunction", test_add_path), | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| "name": "test_subtract.py", | ||
| "path": os.fspath(test_subtract_path), | ||
| "type_": "file", | ||
| "id_": os.fspath(test_subtract_path), | ||
| "children": [ | ||
| { | ||
| "name": "TestSubtractFunction", | ||
| "path": os.fspath(test_subtract_path), | ||
| "type_": "class", | ||
| "children": [ | ||
| { | ||
| "name": "test_subtract_negative_numbers", | ||
| "path": os.fspath(test_subtract_path), | ||
| "lineno": find_test_line_number( | ||
| "test_subtract_negative_numbers", | ||
| os.fspath(test_subtract_path), | ||
| ), | ||
| "type_": "test", | ||
| "id_": get_absolute_test_id( | ||
| "test_subtract.py::TestSubtractFunction::test_subtract_negative_numbers", | ||
| test_subtract_path, | ||
| ), | ||
| "runID": get_absolute_test_id( | ||
| "test_subtract.py::TestSubtractFunction::test_subtract_negative_numbers", | ||
| test_subtract_path, | ||
| ), | ||
| }, | ||
| { | ||
| "name": "test_subtract_positive_numbers", | ||
| "path": os.fspath(test_subtract_path), | ||
| "lineno": find_test_line_number( | ||
| "test_subtract_positive_numbers", | ||
| os.fspath(test_subtract_path), | ||
| ), | ||
| "type_": "test", | ||
| "id_": get_absolute_test_id( | ||
| "test_subtract.py::TestSubtractFunction::test_subtract_positive_numbers", | ||
| test_subtract_path, | ||
| ), | ||
| "runID": get_absolute_test_id( | ||
| "test_subtract.py::TestSubtractFunction::test_subtract_positive_numbers", | ||
| test_subtract_path, | ||
| ), | ||
| }, | ||
| ], | ||
| "id_": get_absolute_test_id( | ||
| "test_subtract.py::TestSubtractFunction", | ||
| test_subtract_path, | ||
| ), | ||
| "lineno": find_class_line_number("TestSubtractFunction", test_subtract_path), | ||
| }, | ||
| { | ||
| "name": "TestDuplicateFunction", | ||
| "path": os.fspath(test_subtract_path), | ||
| "type_": "class", | ||
| "children": [ | ||
| { | ||
| "name": "test_dup_s", | ||
| "path": os.fspath(test_subtract_path), | ||
| "lineno": find_test_line_number( | ||
| "test_dup_s", | ||
| os.fspath(test_subtract_path), | ||
| ), | ||
| "type_": "test", | ||
| "id_": get_absolute_test_id( | ||
| "test_subtract.py::TestDuplicateFunction::test_dup_s", | ||
| test_subtract_path, | ||
| ), | ||
| "runID": get_absolute_test_id( | ||
| "test_subtract.py::TestDuplicateFunction::test_dup_s", | ||
| test_subtract_path, | ||
| ), | ||
| }, | ||
| ], | ||
| "id_": get_absolute_test_id( | ||
| "test_subtract.py::TestDuplicateFunction", | ||
| test_subtract_path, | ||
| ), | ||
| "lineno": find_class_line_number("TestDuplicateFunction", test_subtract_path), | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| "id_": os.fspath(unittest_folder_path), | ||
| } | ||
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.