@@ -14,11 +14,12 @@ import { CodeActionKind, debug, Disposable, ExtensionContext, extensions, Indent
1414import  {  createDeferred  }  from  '../utils/async' ; 
1515import  {  registerTypes  as  activationRegisterTypes  }  from  './activation/serviceRegistry' ; 
1616import  {  IExtensionActivationService  }  from  './activation/types' ; 
17+ import  {  IExtensionApi  }  from  './api' ; 
1718import  {  registerTypes  as  appRegisterTypes  }  from  './application/serviceRegistry' ; 
1819import  {  IApplicationDiagnostics  }  from  './application/types' ; 
1920import  {  IWorkspaceService  }  from  './common/application/types' ; 
2021import  {  PythonSettings  }  from  './common/configSettings' ; 
21- import  {  PYTHON ,  PYTHON_LANGUAGE ,  STANDARD_OUTPUT_CHANNEL  }  from  './common/constants' ; 
22+ import  {  isTestExecution ,   PYTHON ,  PYTHON_LANGUAGE ,  STANDARD_OUTPUT_CHANNEL  }  from  './common/constants' ; 
2223import  {  PythonInstaller  }  from  './common/installer/pythonInstallation' ; 
2324import  {  registerTypes  as  installerRegisterTypes  }  from  './common/installer/serviceRegistry' ; 
2425import  {  registerTypes  as  platformRegisterTypes  }  from  './common/platform/serviceRegistry' ; 
@@ -66,17 +67,19 @@ import { TEST_OUTPUT_CHANNEL } from './unittests/common/constants';
6667import  {  registerTypes  as  unitTestsRegisterTypes  }  from  './unittests/serviceRegistry' ; 
6768
6869const  activationDeferred  =  createDeferred < void > ( ) ; 
69- export  const  activated  =  activationDeferred . promise ; 
7070
7171// tslint:disable-next-line:max-func-body-length 
72- export  async  function  activate ( context : ExtensionContext )  { 
72+ export  async  function  activate ( context : ExtensionContext ) :  Promise < IExtensionApi >  { 
7373 const  cont  =  new  Container ( ) ; 
7474 const  serviceManager  =  new  ServiceManager ( cont ) ; 
7575 const  serviceContainer  =  new  ServiceContainer ( cont ) ; 
7676 registerServices ( context ,  serviceManager ,  serviceContainer ) ; 
7777
78-  const  appDiagnostics  =  serviceContainer . get < IApplicationDiagnostics > ( IApplicationDiagnostics ) ; 
79-  await  appDiagnostics . performPreStartupHealthCheck ( ) ; 
78+  // When testing, do not perform health checks, as modal dialogs can be displayed. 
79+  if  ( ! isTestExecution ( ) )  { 
80+  const  appDiagnostics  =  serviceContainer . get < IApplicationDiagnostics > ( IApplicationDiagnostics ) ; 
81+  await  appDiagnostics . performPreStartupHealthCheck ( ) ; 
82+  } 
8083
8184 const  interpreterManager  =  serviceContainer . get < IInterpreterService > ( IInterpreterService ) ; 
8285 // This must be completed before we can continue as language server needs the interpreter path. 
@@ -98,7 +101,7 @@ export async function activate(context: ExtensionContext) {
98101 sortImports . registerCommands ( ) ; 
99102
100103 serviceManager . get < ICodeExecutionManager > ( ICodeExecutionManager ) . registerCommands ( ) ; 
101-  sendStartupTelemetry ( activated ,  serviceContainer ) . ignoreErrors ( ) ; 
104+  sendStartupTelemetry ( activationDeferred . promise ,  serviceContainer ) . ignoreErrors ( ) ; 
102105
103106 const  pythonInstaller  =  new  PythonInstaller ( serviceContainer ) ; 
104107 pythonInstaller . checkPythonInstallation ( PythonSettings . getInstance ( ) ) 
@@ -164,6 +167,8 @@ export async function activate(context: ExtensionContext) {
164167
165168 serviceContainer . get < IDebuggerBanner > ( IDebuggerBanner ) . initialize ( ) ; 
166169 activationDeferred . resolve ( ) ; 
170+ 
171+  return  {  ready : activationDeferred . promise  } ; 
167172} 
168173
169174function  registerServices ( context : ExtensionContext ,  serviceManager : ServiceManager ,  serviceContainer : ServiceContainer )  { 
0 commit comments