Skip to content

Commit

Permalink
feat: add support for Python projects using pipenv
Browse files Browse the repository at this point in the history
  • Loading branch information
taleinat authored and Anton Drukh committed Aug 1, 2018
1 parent 179fa24 commit 2a6938f
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var DETECTABLE_FILES = [
'pom.xml',
'build.gradle',
'build.sbt',
'Pipfile',
'requirements.txt',
'Gopkg.lock',
'vendor/vendor.json',
Expand All @@ -35,6 +36,7 @@ var DETECTABLE_PACKAGE_MANAGERS = {
'build.gradle': 'gradle',
'build.sbt': 'sbt',
'yarn.lock': 'yarn',
Pipfile: 'pip',
'requirements.txt': 'pip',
'Gopkg.lock': 'golangdep',
'vendor.json': 'govendor',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"snyk-nuget-plugin": "1.6.3",
"snyk-php-plugin": "1.5.1",
"snyk-policy": "1.12.0",
"snyk-python-plugin": "1.6.1",
"snyk-python-plugin": "1.8.0",
"snyk-resolve": "1.0.1",
"snyk-resolve-deps": "3.1.0",
"snyk-sbt-plugin": "1.3.0",
Expand Down
35 changes: 35 additions & 0 deletions test/acceptance/cli.acceptance.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,41 @@ function (t) {
});
});

test('`test pipenv-app --file=Pipfile`',
function (t) {
chdirWorkspaces();
var plugin = {
inspect: function () {
return Promise.resolve({package: {}});
},
};
sinon.spy(plugin, 'inspect');

sinon.stub(plugins, 'loadPlugin');
t.teardown(plugins.loadPlugin.restore);
plugins.loadPlugin
.withArgs('pip')
.returns(plugin);

return cli.test('pipenv-app', {
file: 'Pipfile',
})
.then(function () {
var req = server.popRequest();
t.equal(req.method, 'POST', 'makes POST request');
t.match(req.url, '/vuln/pip', 'posts to correct url');
t.same(plugin.inspect.getCall(0).args,
['pipenv-app', 'Pipfile', {
args: null,
file: 'Pipfile',
org: null,
packageManager: 'pip',
path: 'pipenv-app',
showVulnPaths: true,
}], 'calls python plugin');
});
});

test('`test nuget-app --file=project.assets.json`', function (t) {
chdirWorkspaces();
var plugin = {
Expand Down
11 changes: 11 additions & 0 deletions test/acceptance/workspaces/pipenv-app/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
"Jinja2" = "*"

[dev-packages]

[requires]

0 comments on commit 2a6938f

Please sign in to comment.