1
1
'use strict'
2
2
3
+ delete process . env . PYTHON
4
+
3
5
const test = require ( 'tap' ) . test
4
6
const findPython = require ( '../lib/find-python' )
5
7
const execFile = require ( 'child_process' ) . execFile
6
8
const PythonFinder = findPython . test . PythonFinder
7
9
8
- delete process . env . PYTHON
9
- delete process . env . NODE_GYP_FORCE_PYTHON
10
-
11
10
require ( 'npmlog' ) . level = 'warn'
12
11
13
12
test ( 'find python' , function ( t ) {
@@ -17,8 +16,13 @@ test('find python', function (t) {
17
16
t . strictEqual ( err , null )
18
17
var proc = execFile ( found , [ '-V' ] , function ( err , stdout , stderr ) {
19
18
t . strictEqual ( err , null )
20
- t . strictEqual ( stdout , '' )
21
- t . ok ( / P y t h o n 2 / . test ( stderr ) )
19
+ if ( / P y t h o n 2 / . test ( stderr ) ) {
20
+ t . strictEqual ( stdout , '' )
21
+ t . ok ( / P y t h o n 2 / . test ( stderr ) )
22
+ } else {
23
+ t . ok ( / P y t h o n 3 / . test ( stdout ) )
24
+ t . strictEqual ( stderr , '' )
25
+ }
22
26
} )
23
27
proc . stdout . setEncoding ( 'utf-8' )
24
28
proc . stderr . setEncoding ( 'utf-8' )
@@ -51,6 +55,7 @@ TestPythonFinder.prototype.log = {
51
55
warn : ( ) => { } ,
52
56
error : ( ) => { }
53
57
}
58
+ delete TestPythonFinder . prototype . env . NODE_GYP_FORCE_PYTHON
54
59
55
60
test ( 'find python - python' , function ( t ) {
56
61
t . plan ( 6 )
0 commit comments