@@ -13,15 +13,19 @@ import * as commandApis from '../../client/common/vscodeApis/commandApis';
13
13
import { InterpreterPathCommand } from '../../client/interpreter/interpreterPathCommand' ;
14
14
import { IInterpreterService } from '../../client/interpreter/contracts' ;
15
15
import { PythonEnvironment } from '../../client/pythonEnvironments/info' ;
16
+ import * as workspaceApis from '../../client/common/vscodeApis/workspaceApis' ;
16
17
17
18
suite ( 'Interpreter Path Command' , ( ) => {
18
19
let interpreterService : IInterpreterService ;
19
20
let interpreterPathCommand : InterpreterPathCommand ;
20
21
let registerCommandStub : sinon . SinonStub ;
22
+ let getConfigurationStub : sinon . SinonStub ;
23
+
21
24
setup ( ( ) => {
22
25
interpreterService = mock < IInterpreterService > ( ) ;
23
26
registerCommandStub = sinon . stub ( commandApis , 'registerCommand' ) ;
24
27
interpreterPathCommand = new InterpreterPathCommand ( instance ( interpreterService ) , [ ] ) ;
28
+ getConfigurationStub = sinon . stub ( workspaceApis , 'getConfiguration' ) ;
25
29
} ) ;
26
30
27
31
teardown ( ( ) => {
@@ -43,7 +47,7 @@ suite('Interpreter Path Command', () => {
43
47
} ) ;
44
48
45
49
test ( 'If `workspaceFolder` property exists in `args`, it is used to retrieve setting from config' , async ( ) => {
46
- const args = { workspaceFolder : 'folderPath' } ;
50
+ const args = { workspaceFolder : 'folderPath' , type : 'debugpy' } ;
47
51
when ( interpreterService . getActiveInterpreter ( anything ( ) ) ) . thenCall ( ( arg ) => {
48
52
assert . deepEqual ( arg , Uri . file ( 'folderPath' ) ) ;
49
53
@@ -76,6 +80,10 @@ suite('Interpreter Path Command', () => {
76
80
} ) ;
77
81
78
82
test ( 'If neither of these exists, value of workspace folder is `undefined`' , async ( ) => {
83
+ getConfigurationStub . withArgs ( 'python' ) . returns ( {
84
+ get : sinon . stub ( ) . returns ( false ) ,
85
+ } ) ;
86
+
79
87
const args = [ 'command' ] ;
80
88
81
89
when ( interpreterService . getActiveInterpreter ( undefined ) ) . thenReturn (
0 commit comments