@@ -612,11 +612,15 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
612612
613613 await Promise . all (
614614 workspaces . map ( async ( workspace ) => {
615- if ( ! ( await this . interpreterService . getActiveInterpreter ( workspace . uri ) ) ) {
616- this . commandManager
617- . executeCommand ( constants . Commands . TriggerEnvironmentSelection , workspace . uri )
618- . then ( noop , noop ) ;
619- return ;
615+ // In project-based mode, each project has its own environment,
616+ // so we don't require a global active interpreter
617+ if ( ! useEnvExtension ( ) ) {
618+ if ( ! ( await this . interpreterService . getActiveInterpreter ( workspace . uri ) ) ) {
619+ this . commandManager
620+ . executeCommand ( constants . Commands . TriggerEnvironmentSelection , workspace . uri )
621+ . then ( noop , noop ) ;
622+ return ;
623+ }
620624 }
621625 await this . discoverTestsInWorkspace ( workspace . uri ) ;
622626 } ) ,
@@ -699,9 +703,13 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
699703 const workspaces : readonly WorkspaceFolder [ ] = this . workspaceService . workspaceFolders || [ ] ;
700704 await Promise . all (
701705 workspaces . map ( async ( workspace ) => {
702- if ( ! ( await this . interpreterService . getActiveInterpreter ( workspace . uri ) ) ) {
703- traceError ( 'Cannot trigger test discovery as a valid interpreter is not selected' ) ;
704- return ;
706+ // In project-based mode, each project has its own environment,
707+ // so we don't require a global active interpreter
708+ if ( ! useEnvExtension ( ) ) {
709+ if ( ! ( await this . interpreterService . getActiveInterpreter ( workspace . uri ) ) ) {
710+ traceError ( 'Cannot trigger test discovery as a valid interpreter is not selected' ) ;
711+ return ;
712+ }
705713 }
706714 await this . refreshTestDataInternal ( workspace . uri ) ;
707715 } ) ,
0 commit comments