Skip to content

Enhance test discovery payload handling with compact/expansion on paths in payload#25982

Open
eleanorjboyd wants to merge 6 commits into
microsoft:mainfrom
eleanorjboyd:bad-raven
Open

Enhance test discovery payload handling with compact/expansion on paths in payload#25982
eleanorjboyd wants to merge 6 commits into
microsoft:mainfrom
eleanorjboyd:bad-raven

Conversation

@eleanorjboyd

Copy link
Copy Markdown
Member

No description provided.

# Conflicts:
#	python_files/vscode_pytest/__init__.py
#	src/client/testing/testController/common/testDiscoveryHandler.ts
#	src/test/testing/testController/common/testDiscoveryHandler.unit.test.ts
@eleanorjboyd eleanorjboyd requested a review from Copilot June 8, 2026 03:07
@eleanorjboyd eleanorjboyd self-assigned this Jun 8, 2026
@eleanorjboyd eleanorjboyd added the bug Issue identified by VS Code Team member as probable bug label Jun 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in TestDiscoveryHandler.processDiscovery() before populating the test tree.
  • Extend the discovery payload typing to support compact payload metadata (payloadVersion, pathBase, idBase) and tests: null for 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

Comment thread python_files/vscode_pytest/__init__.py
Comment thread python_files/tests/pytestadapter/test_discovery.py Outdated
eleanorjboyd and others added 4 commits June 7, 2026 20:12
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>
@eleanorjboyd eleanorjboyd marked this pull request as ready for review June 8, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug skip-issue-check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants