@@ -28,7 +28,7 @@ import { CommandsWithoutArgs } from '../../../../client/common/application/comma
2828import { ICommandManager , IWorkspaceService } from '../../../../client/common/application/types' ;
2929import { Commands } from '../../../../client/common/constants' ;
3030import { IPlatformService } from '../../../../client/common/platform/types' ;
31- import { IDisposable , IDisposableRegistry , Resource } from '../../../../client/common/types' ;
31+ import { IDisposable , IDisposableRegistry , IInterpreterPathService , Resource } from '../../../../client/common/types' ;
3232import { Common } from '../../../../client/common/utils/localize' ;
3333import { noop } from '../../../../client/common/utils/misc' ;
3434import { IInterpreterHelper , IInterpreterService } from '../../../../client/interpreter/contracts' ;
@@ -46,6 +46,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => {
4646 let commandManager : typemoq . IMock < ICommandManager > ;
4747 let helper : typemoq . IMock < IInterpreterHelper > ;
4848 let serviceContainer : typemoq . IMock < IServiceContainer > ;
49+ let interpreterPathService : typemoq . IMock < IInterpreterPathService > ;
4950 function createContainer ( ) {
5051 serviceContainer = typemoq . Mock . ofType < IServiceContainer > ( ) ;
5152 workspaceService = typemoq . Mock . ofType < IWorkspaceService > ( ) ;
@@ -76,6 +77,11 @@ suite('Application Diagnostics - Checks Python Interpreter', () => {
7677 serviceContainer
7778 . setup ( ( s ) => s . get ( typemoq . It . isValue ( IPlatformService ) ) )
7879 . returns ( ( ) => platformService . object ) ;
80+ interpreterPathService = typemoq . Mock . ofType < IInterpreterPathService > ( ) ;
81+ interpreterPathService . setup ( ( i ) => i . get ( typemoq . It . isAny ( ) ) ) . returns ( ( ) => 'customPython' ) ;
82+ serviceContainer
83+ . setup ( ( s ) => s . get ( typemoq . It . isValue ( IInterpreterPathService ) ) )
84+ . returns ( ( ) => interpreterPathService . object ) ;
7985 helper = typemoq . Mock . ofType < IInterpreterHelper > ( ) ;
8086 serviceContainer . setup ( ( s ) => s . get ( typemoq . It . isValue ( IInterpreterHelper ) ) ) . returns ( ( ) => helper . object ) ;
8187 serviceContainer . setup ( ( s ) => s . get ( typemoq . It . isValue ( IDisposableRegistry ) ) ) . returns ( ( ) => [ ] ) ;
@@ -160,7 +166,9 @@ suite('Application Diagnostics - Checks Python Interpreter', () => {
160166 expect ( diagnostics ) . to . be . deep . equal ( [ ] , 'not the same' ) ;
161167 } ) ;
162168
163- test ( 'Should return diagnostics if there are no interpreters after double-checking' , async ( ) => {
169+ test ( 'Should return diagnostics if there are no interpreters and no interpreter has been explicitly set' , async ( ) => {
170+ interpreterPathService . reset ( ) ;
171+ interpreterPathService . setup ( ( i ) => i . get ( typemoq . It . isAny ( ) ) ) . returns ( ( ) => 'python' ) ;
164172 interpreterService
165173 . setup ( ( i ) => i . hasInterpreters ( ) )
166174 . returns ( ( ) => Promise . resolve ( false ) )
0 commit comments