@@ -29,7 +29,12 @@ import { CommandsWithoutArgs } from '../../../../client/common/application/comma
2929import { IPlatformService } from '../../../../client/common/platform/types' ;
3030import { IConfigurationService , IDisposableRegistry , IPythonSettings } from '../../../../client/common/types' ;
3131import { noop } from '../../../../client/common/utils/misc' ;
32- import { IInterpreterHelper , IInterpreterService , InterpreterType } from '../../../../client/interpreter/contracts' ;
32+ import {
33+ IInterpreterHelper ,
34+ IInterpreterService ,
35+ InterpreterType ,
36+ PythonInterpreter
37+ } from '../../../../client/interpreter/contracts' ;
3338import { IServiceContainer } from '../../../../client/ioc/types' ;
3439
3540suite ( 'Application Diagnostics - Checks Python Interpreter' , ( ) => {
@@ -129,7 +134,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => {
129134 expect ( diagnostics ) . to . be . deep . equal ( [ ] ) ;
130135 settings . verifyAll ( ) ;
131136 } ) ;
132- test ( 'Should return diagnostics if there are no interpreters' , async ( ) => {
137+ test ( 'Should return diagnostics if there are no interpreters after double-checking ' , async ( ) => {
133138 settings
134139 . setup ( ( s ) => s . disableInstallationChecks )
135140 . returns ( ( ) => false )
@@ -138,6 +143,10 @@ suite('Application Diagnostics - Checks Python Interpreter', () => {
138143 . setup ( ( i ) => i . hasInterpreters )
139144 . returns ( ( ) => Promise . resolve ( false ) )
140145 . verifiable ( typemoq . Times . once ( ) ) ;
146+ interpreterService
147+ . setup ( ( i ) => i . getInterpreters ( undefined ) )
148+ . returns ( ( ) => Promise . resolve ( [ ] ) )
149+ . verifiable ( typemoq . Times . once ( ) ) ;
141150
142151 const diagnostics = await diagnosticService . diagnose ( undefined ) ;
143152 expect ( diagnostics ) . to . be . deep . equal (
@@ -147,6 +156,34 @@ suite('Application Diagnostics - Checks Python Interpreter', () => {
147156 settings . verifyAll ( ) ;
148157 interpreterService . verifyAll ( ) ;
149158 } ) ;
159+ test ( 'Should return empty diagnostics if there are interpreters after double-checking' , async ( ) => {
160+ const interpreter : PythonInterpreter = { type : InterpreterType . Unknown } as any ;
161+
162+ settings
163+ . setup ( ( s ) => s . disableInstallationChecks )
164+ . returns ( ( ) => false )
165+ . verifiable ( typemoq . Times . once ( ) ) ;
166+ interpreterService
167+ . setup ( ( i ) => i . hasInterpreters )
168+ . returns ( ( ) => Promise . resolve ( false ) )
169+ . verifiable ( typemoq . Times . once ( ) ) ;
170+ interpreterService
171+ . setup ( ( i ) => i . getInterpreters ( undefined ) )
172+ . returns ( ( ) => Promise . resolve ( [ interpreter ] ) )
173+ . verifiable ( typemoq . Times . once ( ) ) ;
174+ interpreterService
175+ . setup ( ( i ) => i . getActiveInterpreter ( typemoq . It . isAny ( ) ) )
176+ . returns ( ( ) => {
177+ return Promise . resolve ( interpreter ) ;
178+ } )
179+ . verifiable ( typemoq . Times . once ( ) ) ;
180+
181+ const diagnostics = await diagnosticService . diagnose ( undefined ) ;
182+
183+ expect ( diagnostics ) . to . be . deep . equal ( [ ] , 'not the same' ) ;
184+ settings . verifyAll ( ) ;
185+ interpreterService . verifyAll ( ) ;
186+ } ) ;
150187 test ( 'Should return invalid diagnostics if there are interpreters but no current interpreter' , async ( ) => {
151188 settings
152189 . setup ( ( s ) => s . disableInstallationChecks )
0 commit comments