testing: refine compact discovery payload review feedback#26000
Open
eleanorjboyd wants to merge 1 commit into
Open
testing: refine compact discovery payload review feedback#26000eleanorjboyd wants to merge 1 commit into
eleanorjboyd wants to merge 1 commit into
Conversation
- Move isAbsolutePath helper to common/platform/fs-paths so it can be shared instead of duplicated inside testDiscoveryHandler. Uses path.posix.isAbsolute || path.win32.isAbsolute so paths produced on either OS (e.g. coming from a Python subprocess) are recognized. - Tighten create_class_node annotation in vscode_pytest from Any to pytest.Class | DescribeBlockType. DescribeBlockType is imported under TYPE_CHECKING so it remains optional at runtime. - Add unit tests for isAbsolutePath covering POSIX absolute, Windows drive-letter, UNC, and relative paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to #25982 addressing review feedback.
What changed
isAbsolutePathhelper. Moved the cross-platform absolute-path check out oftestDiscoveryHandler.tsand intosrc/client/common/platform/fs-paths.tsso it can be reused. The implementation now delegates topath.posix.isAbsolute || path.win32.isAbsoluteinstead of a hand-rolled regex. This is the right behavior here because the paths come from a Python subprocess and may be formatted for an OS different from the one currently running the extension.create_class_nodeannotation. ReplacedAnywithpytest.Class | DescribeBlockTypeinpython_files/vscode_pytest/__init__.py.DescribeBlockTypeis imported inside the existingif TYPE_CHECKING:block so it stays optional at runtime (matching the runtimeDescribeBlock: Any = Nonefallback whenpytest_describeis not installed).isAbsolutePath. Added a 4-test suite infs-paths.unit.test.tscovering POSIX absolute, Windows drive-letter, Windows UNC, and relative paths.Verification
tsc --noEmit - cleanp .eslinton touched cleanfilesruff check vscode_ cleanpytest/pyright python_files/vscode_pytest/__init__. 0 errorspyisAbsolutePathunit passtestsTestDiscoveryHandlerunit still passtestscompact_discovery_payloadpytest passtestsNotes for reviewers
No behavior change is intended. The new
isAbsolutePathis functionally equivalent to the regex it replaces (both recognize/foo,C:\foo,c:/foo, and\\server\share). Thecreate_class_nodesignature change is purely a type-check improvement and has no runtime effect.