Skip to content

Listen for added workspace folders to also testing.activateLegacyWorkspace() them#26012

Open
vaclavHala wants to merge 2 commits into
microsoft:mainfrom
vaclavHala:test-legacy-init-added-workspace-folders
Open

Listen for added workspace folders to also testing.activateLegacyWorkspace() them#26012
vaclavHala wants to merge 2 commits into
microsoft:mainfrom
vaclavHala:test-legacy-init-added-workspace-folders

Conversation

@vaclavHala

Copy link
Copy Markdown

Fixes #26011

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 addresses #26011 by ensuring legacy testing adapters are initialized for workspace folders that are added after the Python extension has already activated, so test discovery works without requiring a VS Code restart.

Changes:

  • In legacy mode, register a onDidChangeWorkspaceFolders listener and call activateLegacyWorkspace() for newly added folders.
  • Add a unit test covering discovery in a workspace folder added post-activation.
Show a summary per file
File Description
src/client/testing/testController/controller.ts Hooks workspace-folder additions in legacy mode to initialize per-workspace legacy test adapters.
src/test/testing/testController/controller.unit.test.ts Adds coverage to ensure discovery works for folders added after activation.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment on lines +241 to +247
this.disposables.push(
this.workspaceService.onDidChangeWorkspaceFolders((evt) => {
evt.added.forEach((workspace) => {
this.activateLegacyWorkspace(workspace);
});
}),
);
Comment on lines +229 to +230
const onDidChangeWorkspaceFolders = new vscode.EventEmitter<vscode.WorkspaceFoldersChangeEvent>();
const fakeDiscoveryAdapter = sandbox.stub().resolves(undefined);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Legacy discovery does not work for folders added to workspace after python extension activated

2 participants