4
4
import { expect } from 'chai' ;
5
5
import { join as pathJoin } from 'path' ;
6
6
import { SemVer } from 'semver' ;
7
- import { IMock , It as TypeMoqIt , Mock , MockBehavior } from 'typemoq' ;
8
- import { StdErrError } from '../../../client/common/process/types' ;
7
+ import { IMock , It , It as TypeMoqIt , Mock , MockBehavior } from 'typemoq' ;
8
+ import { ShellOptions , StdErrError } from '../../../client/common/process/types' ;
9
9
import { Architecture } from '../../../client/common/utils/platform' ;
10
10
import { buildPythonExecInfo } from '../../../client/pythonEnvironments/exec' ;
11
11
import { getInterpreterInfo } from '../../../client/pythonEnvironments/info/interpreter' ;
@@ -22,7 +22,7 @@ type ShellExecResult = {
22
22
stderr ?: string ;
23
23
} ;
24
24
interface IDeps {
25
- shellExec ( command : string , timeout : number ) : Promise < ShellExecResult > ;
25
+ shellExec ( command : string , options ?: ShellOptions | undefined ) : Promise < ShellExecResult > ;
26
26
}
27
27
28
28
suite ( 'getInterpreterInfo()' , ( ) => {
@@ -43,13 +43,13 @@ suite('getInterpreterInfo()', () => {
43
43
const cmd = `"${ python . command } " "${ script } "` ;
44
44
deps
45
45
// Checking the args is the key point of this test.
46
- . setup ( ( d ) => d . shellExec ( cmd , 15000 ) )
46
+ . setup ( ( d ) => d . shellExec ( cmd , It . isAny ( ) ) )
47
47
. returns ( ( ) =>
48
48
Promise . resolve ( {
49
49
stdout : JSON . stringify ( json ) ,
50
50
} ) ,
51
51
) ;
52
- const shellExec = async ( c : string , t : number ) => deps . object . shellExec ( c , t ) ;
52
+ const shellExec = async ( c : string , t : ShellOptions | undefined ) => deps . object . shellExec ( c , t ) ;
53
53
54
54
await getInterpreterInfo ( python , shellExec ) ;
55
55
@@ -67,13 +67,13 @@ suite('getInterpreterInfo()', () => {
67
67
const cmd = `" path to /my python " "${ script } "` ;
68
68
deps
69
69
// Checking the args is the key point of this test.
70
- . setup ( ( d ) => d . shellExec ( cmd , 15000 ) )
70
+ . setup ( ( d ) => d . shellExec ( cmd , It . isAny ( ) ) )
71
71
. returns ( ( ) =>
72
72
Promise . resolve ( {
73
73
stdout : JSON . stringify ( json ) ,
74
74
} ) ,
75
75
) ;
76
- const shellExec = async ( c : string , t : number ) => deps . object . shellExec ( c , t ) ;
76
+ const shellExec = async ( c : string , t : ShellOptions | undefined ) => deps . object . shellExec ( c , t ) ;
77
77
78
78
await getInterpreterInfo ( _python , shellExec ) ;
79
79
@@ -91,13 +91,13 @@ suite('getInterpreterInfo()', () => {
91
91
const cmd = `"path/to/conda" "run" "-n" "my-env" "python" "${ script } "` ;
92
92
deps
93
93
// Checking the args is the key point of this test.
94
- . setup ( ( d ) => d . shellExec ( cmd , 15000 ) )
94
+ . setup ( ( d ) => d . shellExec ( cmd , It . isAny ( ) ) )
95
95
. returns ( ( ) =>
96
96
Promise . resolve ( {
97
97
stdout : JSON . stringify ( json ) ,
98
98
} ) ,
99
99
) ;
100
- const shellExec = async ( c : string , t : number ) => deps . object . shellExec ( c , t ) ;
100
+ const shellExec = async ( c : string , t : ShellOptions | undefined ) => deps . object . shellExec ( c , t ) ;
101
101
102
102
await getInterpreterInfo ( _python , shellExec ) ;
103
103
@@ -126,7 +126,7 @@ suite('getInterpreterInfo()', () => {
126
126
stdout : JSON . stringify ( json ) ,
127
127
} ) ,
128
128
) ;
129
- const shellExec = async ( c : string , t : number ) => deps . object . shellExec ( c , t ) ;
129
+ const shellExec = async ( c : string , t : ShellOptions | undefined ) => deps . object . shellExec ( c , t ) ;
130
130
131
131
const result = await getInterpreterInfo ( python , shellExec ) ;
132
132
@@ -156,7 +156,7 @@ suite('getInterpreterInfo()', () => {
156
156
stdout : JSON . stringify ( json ) ,
157
157
} ) ,
158
158
) ;
159
- const shellExec = async ( c : string , t : number ) => deps . object . shellExec ( c , t ) ;
159
+ const shellExec = async ( c : string , t : ShellOptions | undefined ) => deps . object . shellExec ( c , t ) ;
160
160
161
161
const result = await getInterpreterInfo ( python , shellExec ) ;
162
162
@@ -186,7 +186,7 @@ suite('getInterpreterInfo()', () => {
186
186
stdout : JSON . stringify ( json ) ,
187
187
} ) ,
188
188
) ;
189
- const shellExec = async ( c : string , t : number ) => deps . object . shellExec ( c , t ) ;
189
+ const shellExec = async ( c : string , t : ShellOptions | undefined ) => deps . object . shellExec ( c , t ) ;
190
190
191
191
const result = await getInterpreterInfo ( python , shellExec ) ;
192
192
@@ -200,7 +200,7 @@ suite('getInterpreterInfo()', () => {
200
200
// We check the args in other tests.
201
201
. setup ( ( d ) => d . shellExec ( TypeMoqIt . isAny ( ) , TypeMoqIt . isAny ( ) ) )
202
202
. returns ( ( ) => Promise . reject ( err ) ) ;
203
- const shellExec = async ( c : string , t : number ) => deps . object . shellExec ( c , t ) ;
203
+ const shellExec = async ( c : string , t : ShellOptions | undefined ) => deps . object . shellExec ( c , t ) ;
204
204
205
205
const result = getInterpreterInfo ( python , shellExec ) ;
206
206
@@ -214,7 +214,7 @@ suite('getInterpreterInfo()', () => {
214
214
// We check the args in other tests.
215
215
. setup ( ( d ) => d . shellExec ( TypeMoqIt . isAny ( ) , TypeMoqIt . isAny ( ) ) )
216
216
. returns ( ( ) => Promise . reject ( err ) ) ;
217
- const shellExec = async ( c : string , t : number ) => deps . object . shellExec ( c , t ) ;
217
+ const shellExec = async ( c : string , t : ShellOptions | undefined ) => deps . object . shellExec ( c , t ) ;
218
218
219
219
const result = getInterpreterInfo ( python , shellExec ) ;
220
220
@@ -227,7 +227,7 @@ suite('getInterpreterInfo()', () => {
227
227
// We check the args in other tests.
228
228
. setup ( ( d ) => d . shellExec ( TypeMoqIt . isAny ( ) , TypeMoqIt . isAny ( ) ) )
229
229
. returns ( ( ) => Promise . resolve ( { stdout : 'bad json' } ) ) ;
230
- const shellExec = async ( c : string , t : number ) => deps . object . shellExec ( c , t ) ;
230
+ const shellExec = async ( c : string , t : ShellOptions | undefined ) => deps . object . shellExec ( c , t ) ;
231
231
232
232
const result = getInterpreterInfo ( python , shellExec ) ;
233
233
0 commit comments