Enhance test discovery payload handling with compact/expansion on paths in payload#25982
Open
eleanorjboyd wants to merge 6 commits into
Open
Enhance test discovery payload handling with compact/expansion on paths in payload#25982eleanorjboyd wants to merge 6 commits into
eleanorjboyd wants to merge 6 commits into
Conversation
# Conflicts: # python_files/vscode_pytest/__init__.py # src/client/testing/testController/common/testDiscoveryHandler.ts # src/test/testing/testController/common/testDiscoveryHandler.unit.test.ts
There was a problem hiding this comment.
Pull request overview
This PR introduces a “compact” pytest discovery payload format (with paths/IDs relative to shared bases) and adds expansion logic on the extension side so the existing discovery tree building continues to work with absolute paths.
Changes:
- Add TypeScript expansion (
expandCompactDiscoveryPayload) and invoke it inTestDiscoveryHandler.processDiscovery()before populating the test tree. - Extend the discovery payload typing to support compact payload metadata (
payloadVersion,pathBase,idBase) andtests: nullfor error cases. - Update pytest Python-side discovery to emit a compact payload and add/adjust unit tests and helper parsing to expand compact payloads in tests.
Show a summary per file
| File | Description |
|---|---|
| src/test/testing/testController/common/testDiscoveryHandler.unit.test.ts | Adds unit tests for compact-payload expansion and for tests: null error payload behavior. |
| src/client/testing/testController/common/types.ts | Updates discovery payload types to support tests: null and compact payload metadata fields. |
| src/client/testing/testController/common/testDiscoveryHandler.ts | Implements compact payload expansion and applies it before populating the VS Code test tree. |
| python_files/vscode_pytest/init.py | Switches pytest discovery emission to a compact payload format and removes the prior custom JSON encoder path. |
| python_files/tests/pytestadapter/test_discovery.py | Adds tests for compact payload creation and for expanded payload behavior after RPC parsing. |
| python_files/tests/pytestadapter/helpers.py | Expands compact discovery payloads when parsing JSON-RPC messages in pytest adapter tests and tightens some I/O details. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 2
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cast dict literal to TestNode and list children to List[Any] so pyright accepts dict/list usage where the TypedDict declares Children. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Children class doesn't implement __iter__, so iterating it directly raised TypeError during pytest discovery, causing the discovery payload to surface as status='error' in end-to-end tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The tests stubbed resolveDiscovery to capture the raw payload, but the compact discovery payload returns paths relative to pathBase. Expand the payload before asserting so the symlink-path assertions still hold against the absolute symlink path produced by expansion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dmitrivMS
approved these changes
Jun 8, 2026
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.
No description provided.