@@ -195,6 +195,77 @@ test('find python - no python, use python launcher', function (t) {
195
195
}
196
196
} )
197
197
198
+ test ( 'find python - python 3, use python launcher' , function ( t ) {
199
+ t . plan ( 10 )
200
+
201
+ var f = new TestPythonFinder ( 'python' , done )
202
+ f . env = { }
203
+ f . win = true
204
+
205
+ f . which = function ( program , cb ) {
206
+ t . strictEqual ( program , 'python' )
207
+ cb ( null , program )
208
+ }
209
+ f . execFile = function ( program , args , opts , cb ) {
210
+ f . execFile = function ( program , args , opts , cb ) {
211
+ f . execFile = function ( program , args , opts , cb ) {
212
+ t . strictEqual ( program , 'Z:\\snake.exe' )
213
+ t . ok ( / i m p o r t p l a t f o r m / . test ( args [ 1 ] ) )
214
+ cb ( null , '2.7.0' )
215
+ }
216
+ t . strictEqual ( program , 'py.exe' )
217
+ t . notEqual ( args . indexOf ( '-2' ) , - 1 )
218
+ t . notEqual ( args . indexOf ( '-c' ) , - 1 )
219
+ cb ( null , 'Z:\\snake.exe' )
220
+ }
221
+ t . strictEqual ( program , 'python' )
222
+ t . ok ( / i m p o r t p l a t f o r m / . test ( args [ 1 ] ) )
223
+ cb ( null , '3.0.0' )
224
+ }
225
+ f . checkPython ( )
226
+
227
+ function done ( err , python ) {
228
+ t . strictEqual ( err , null )
229
+ t . strictEqual ( python , 'Z:\\snake.exe' )
230
+ }
231
+ } )
232
+
233
+ test ( 'find python - python 3, use python launcher, python 2 too old' ,
234
+ function ( t ) {
235
+ t . plan ( 9 )
236
+
237
+ var f = new TestPythonFinder ( 'python' , done )
238
+ f . checkedPythonLauncher = false
239
+ f . env = { }
240
+ f . win = true
241
+
242
+ f . which = function ( program , cb ) {
243
+ t . strictEqual ( program , 'python' )
244
+ cb ( null , program )
245
+ }
246
+ f . execFile = function ( program , args , opts , cb ) {
247
+ f . execFile = function ( program , args , opts , cb ) {
248
+ f . execFile = function ( program , args , opts , cb ) {
249
+ t . strictEqual ( program , 'Z:\\snake.exe' )
250
+ t . ok ( / i m p o r t p l a t f o r m / . test ( args [ 1 ] ) )
251
+ cb ( null , '2.3.4' )
252
+ }
253
+ t . strictEqual ( program , 'py.exe' )
254
+ t . notEqual ( args . indexOf ( '-2' ) , - 1 )
255
+ t . notEqual ( args . indexOf ( '-c' ) , - 1 )
256
+ cb ( null , 'Z:\\snake.exe' )
257
+ }
258
+ t . strictEqual ( program , 'python' )
259
+ t . ok ( / i m p o r t p l a t f o r m / . test ( args [ 1 ] ) )
260
+ cb ( null , '3.0.0' )
261
+ }
262
+ f . checkPython ( )
263
+
264
+ function done ( err , python ) {
265
+ t . ok ( / i s n o t s u p p o r t e d b y g y p / . test ( err ) )
266
+ }
267
+ } )
268
+
198
269
test ( 'find python - no python, no python launcher, good guess' , function ( t ) {
199
270
t . plan ( 6 )
200
271
0 commit comments