You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Legacy discovery does not work for folders added to workspace after python extension activated #26011
I'm using pytest in the legacy mode (i.e. env extension disabled). When I'm already in vscode multi-folder workspace mode, and I add new folder to my workspace, test integration in the new folder does not work and I have to restart vscode to fix this. In the Python Output window I can see message
[error] Unable to find test adapter for workspace.
Investigation and proposed solution
I believe this happens because the method activateLegacyWorkspace is only ever called from activate, meaning if new workspace folder is added after the activation, it does not get initialized so that the this.testAdapters map will never contain entry for the added workspace folder.
Solution is probably to listen for workspace folder changes and run the activate method for newly added folders.
Similar problem may exist for the new project mode, I'm not yet familiar with how that works so haven't tested that.
Steps to reproduce:
be in multifolder mode, the easiest is to just File > Add Folder to Workspace (this step is important, if you start from single folder mode, adding another folder will restart Extension Host in new mode which will re-activate whole python extension and the bug will not manifest)
add new folder to the workspace that contains the following files:
Hi! Will get that PR reviewed and merged for you. Are you using the legacy version for a specific reason? Would love to hear why the envs ext isn't working for you so I can get that fixed!
Activity
eleanorjboyd commentedon Jul 24, 2026
Hi! Will get that PR reviewed and merged for you. Are you using the legacy version for a specific reason? Would love to hear why the envs ext isn't working for you so I can get that fixed!
Listen for added workspace folders to also testing.activateLegacyWork…