11'use strict'
22
3+ delete process . env . PYTHON
4+
35const test = require ( 'tap' ) . test
46const findPython = require ( '../lib/find-python' )
57const execFile = require ( 'child_process' ) . execFile
68const PythonFinder = findPython . test . PythonFinder
79
8- delete process . env . PYTHON
9- delete process . env . NODE_GYP_FORCE_PYTHON
10-
1110require ( 'npmlog' ) . level = 'warn'
1211
1312test ( 'find python' , function ( t ) {
@@ -17,8 +16,13 @@ test('find python', function (t) {
1716 t . strictEqual ( err , null )
1817 var proc = execFile ( found , [ '-V' ] , function ( err , stdout , stderr ) {
1918 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+ }
2226 } )
2327 proc . stdout . setEncoding ( 'utf-8' )
2428 proc . stderr . setEncoding ( 'utf-8' )
@@ -51,6 +55,7 @@ TestPythonFinder.prototype.log = {
5155 warn : ( ) => { } ,
5256 error : ( ) => { }
5357}
58+ delete TestPythonFinder . prototype . env . NODE_GYP_FORCE_PYTHON
5459
5560test ( 'find python - python' , function ( t ) {
5661 t . plan ( 6 )
0 commit comments