Skip to content

Commit ee46c5c

Browse files
committed
test: configure proper devDir for invoking configure()
test/test-configure-python.js downloads a fresh set of headers to the package directory each time. By setting to the default global cache dir we get to re-use cached headers and skip the download step.
1 parent 7e81270 commit ee46c5c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

test/common.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const envPaths = require('env-paths')
2+
3+
module.exports.devDir = () => envPaths('node-gyp', { suffix: '' }).cache

test/test-configure-python.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
var test = require('tap').test
44
var path = require('path')
5+
var devDir = require('./common').devDir()
56
var gyp = require('../lib/node-gyp')
67
var requireInject = require('require-inject')
78
var configure = requireInject('../lib/configure', {
@@ -30,6 +31,7 @@ test('configure PYTHONPATH with no existing env', function (t) {
3031
t.equal(process.env.PYTHONPATH, EXPECTED_PYPATH)
3132
return SPAWN_RESULT
3233
}
34+
prog.devDir = devDir
3335
configure(prog, [], t.fail)
3436
})
3537

@@ -42,14 +44,14 @@ test('configure PYTHONPATH with existing env of one dir', function (t) {
4244
var prog = gyp()
4345
prog.parseArgv([])
4446
prog.spawn = function () {
45-
4647
t.equal(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR))
4748

4849
var dirs = process.env.PYTHONPATH.split(SEPARATOR)
4950
t.deepEqual(dirs, [EXPECTED_PYPATH, existingPath])
5051

5152
return SPAWN_RESULT
5253
}
54+
prog.devDir = devDir
5355
configure(prog, [], t.fail)
5456
})
5557

@@ -64,13 +66,13 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) {
6466
var prog = gyp()
6567
prog.parseArgv([])
6668
prog.spawn = function () {
67-
6869
t.equal(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR))
6970

7071
var dirs = process.env.PYTHONPATH.split(SEPARATOR)
7172
t.deepEqual(dirs, [EXPECTED_PYPATH, pythonDir1, pythonDir2])
7273

7374
return SPAWN_RESULT
7475
}
76+
prog.devDir = devDir
7577
configure(prog, [], t.fail)
7678
})

0 commit comments

Comments
 (0)