Skip to content

Commit

Permalink
test: remove deps which compiles on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Mila Votradovec authored and miiila committed May 23, 2019
1 parent 3388413 commit 2140039
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 25 deletions.
43 changes: 27 additions & 16 deletions test/inspect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var sinon = require('sinon');
var plugin = require('../lib');
var subProcess = require('../lib/sub-process');
var testUtils = require('./test-utils');
var os = require('os');


test('install requirements in "pip-app" venv (may take a while)', function (t) {
Expand Down Expand Up @@ -330,18 +331,20 @@ test('package name differs from requirement (- vs _)', function (t) {
}
})
.then(function () {
return plugin.inspect('.', 'requirements.txt');
return plugin.inspect('.', 'requirements.txt', {allowMissing: true});
})
.then(function (result) {
var pkg = result.package;
t.same(pkg.dependencies['dj-database-url'], {
name: 'dj-database-url',
version: '0.4.2',
}, 'dj-database-url looks ok');
t.same(pkg.dependencies['posix-ipc'], {
name: 'posix-ipc',
version: '1.0.0',
}, 'posix-ipc looks ok');
if (os.platform() !== 'win32') {
t.same(pkg.dependencies['posix-ipc'], {
name: 'posix-ipc',
version: '1.0.0',
}, 'posix-ipc looks ok');
}
t.end();
});
});
Expand Down Expand Up @@ -397,15 +400,20 @@ test('package depends on platform', function (t) {
}
})
.then(function () {
return plugin.inspect('.', 'requirements.txt');
return plugin.inspect('.', 'requirements.txt', {allowMissing: true});
})
.then(function (result) {
var pkg = result.package;
t.notOk(pkg.dependencies.pypiwin32, 'win32 dep ignored');
t.same(pkg.dependencies['posix-ipc'], {
name: 'posix-ipc',
version: '1.0.0',
}, 'posix-ipc looks ok');
if (os.platform() !== 'win32') {
t.notOk(pkg.dependencies.pypiwin32, 'win32 dep ignored');
t.same(pkg.dependencies['posix-ipc'], {
name: 'posix-ipc',
version: '1.0.0',
}, 'posix-ipc looks ok');
} else {
t.ok(pkg.dependencies.pypiwin32, 'win32 installed');
t.notOk(pkg.dependencies['posix-ipc'], 'not win32 dep skipped');
}
t.end();
});
});
Expand All @@ -420,16 +428,18 @@ test('editables ignored', function (t) {
}
})
.then(function () {
return plugin.inspect('.', 'requirements.txt');
return plugin.inspect('.', 'requirements.txt', {allowMissing: true});
})
.then(function (result) {
var pkg = result.package;
t.notOk(pkg.dependencies['simple'], 'editable dep ignored');
t.notOk(pkg.dependencies['sample'], 'editable subdir dep ignored');
t.same(pkg.dependencies['posix-ipc'], {
name: 'posix-ipc',
version: '1.0.0',
}, 'posix-ipc looks ok');
if (os.platform() !== 'win32') {
t.same(pkg.dependencies['posix-ipc'], {
name: 'posix-ipc',
version: '1.0.0',
}, 'posix-ipc looks ok');
}
t.end();
});
});
Expand Down Expand Up @@ -647,6 +657,7 @@ test('inspect pipenv app with auto-created virtualenv', function (t) {
teardowns.push(testUtils.setWorkonHome());

// Have pipenv create and update a virtualenv if it doesn't exist.
subProcess.executeSync('pip', ['install', 'pipenv']);
var proc = subProcess.executeSync('pipenv', ['--venv']);
if (proc.status !== 0) {
teardowns.push(function () {
Expand Down
12 changes: 6 additions & 6 deletions test/python-plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test('check build args with array', function (t) {
'-argOne',
'-argTwo',
]);
t.match(result[0], /.*\/plug\/pip_resolve\.py/);
t.match(result[0], /.*[\/\\]plug[\/\\]pip_resolve\.py/);
t.deepEqual(result.slice(1), [
'requirements.txt',
'-argOne',
Expand All @@ -20,7 +20,7 @@ test('check build args with array & allowMissing', function (t) {
'-argOne',
'-argTwo',
]);
t.match(result[0], /.*\/plug\/pip_resolve\.py/);
t.match(result[0], /.*[\/\\]plug[\/\\]pip_resolve\.py/);
t.deepEqual(result.slice(1), [
'requirements.txt',
'--allow-missing',
Expand All @@ -35,7 +35,7 @@ test('check build args with array & devDeps', function (t) {
'-argOne',
'-argTwo',
]);
t.match(result[0], /.*\/plug\/pip_resolve\.py/);
t.match(result[0], /.*[\/\\]plug[\/\\]pip_resolve\.py/);
t.deepEqual(result.slice(1), [
'requirements.txt',
'--dev-deps',
Expand All @@ -50,7 +50,7 @@ test('check build args with array & allowMissing & devDeps', function (t) {
'-argOne',
'-argTwo',
]);
t.match(result[0], /.*\/plug\/pip_resolve\.py/);
t.match(result[0], /.*[\/\\]plug[\/\\]pip_resolve\.py/);
t.deepEqual(result.slice(1), [
'requirements.txt',
'--allow-missing',
Expand All @@ -64,7 +64,7 @@ test('check build args with array & allowMissing & devDeps', function (t) {
test('check build args with string', function (t) {
var result = plugin.buildArgs('requirements.txt', false,
'../plug', false, '-argOne -argTwo');
t.match(result[0], /.*\/plug\/pip_resolve\.py/);
t.match(result[0], /.*[\/\\]plug[\/\\]pip_resolve\.py/);
t.deepEqual(result.slice(1), [
'requirements.txt',
'-argOne -argTwo',
Expand All @@ -75,7 +75,7 @@ test('check build args with string', function (t) {
test('check build args with string & allowMissing', function (t) {
var result = plugin.buildArgs('requirements.txt', true,
'../plug', false, '-argOne -argTwo');
t.match(result[0], /.*\/plug\/pip_resolve\.py/);
t.match(result[0], /.*[\/\\]plug[\/\\]pip_resolve\.py/);
t.deepEqual(result.slice(1), [
'requirements.txt',
'--allow-missing',
Expand Down
2 changes: 1 addition & 1 deletion test/workspaces/pip-app-deps-conditional/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pypiwin32==223; sys_platform == 'win32'
posix_ipc==1.0.0
posix_ipc==1.0.0; sys_platform != 'win32'
2 changes: 1 addition & 1 deletion test/workspaces/pip-app-deps-editable/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
git+https://github.com/snyk-fixtures/python-pypi-package-simple@v1.0.0#egg=simple==v1.0.0
-e git+https://github.com/snyk-fixtures/python-pypi-package-sample-subdir#egg=sample&subdirectory=subdir
posix_ipc==1.0.0
posix_ipc==1.0.0; sys_platform != 'win32'
2 changes: 1 addition & 1 deletion test/workspaces/pip-app-deps-with-dashes/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dj_database_url==0.4.2
posix_ipc==1.0.0
posix_ipc==1.0.0; sys_platform != 'win32'

0 comments on commit 2140039

Please sign in to comment.