Skip to content

Commit

Permalink
fix: support for pipenv with python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
gemaxim committed Aug 6, 2024
1 parent d8914fe commit 456944e
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 51 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ commands:
parameters:
items:
type: string
default: go gradle python elixir composer gradle@6 maven sbt dotnet
default: go gradle python pipenv elixir composer gradle@6 maven sbt dotnet
steps:
- run:
name: Installing Rosetta
Expand Down Expand Up @@ -333,7 +333,7 @@ commands:
- run:
name: Installing Node.js + other test dependencies
command: |
apk add --update nodejs npm bash maven git go gradle python3 py3-pip elixir composer
apk add --update nodejs npm bash maven git go gradle python3 pipenv py3-pip elixir composer
pip3 install pipenv requests PyYAML setuptools==70.3.0
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && chmod +x dotnet-install.sh && ./dotnet-install.sh
Expand Down
62 changes: 14 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"snyk-nuget-plugin": "2.7.2",
"snyk-php-plugin": "1.9.2",
"snyk-policy": "^1.25.0",
"snyk-python-plugin": "2.1.1",
"snyk-python-plugin": "2.2.1",
"snyk-resolve-deps": "4.7.3",
"snyk-sbt-plugin": "2.18.1",
"snyk-swiftpm-plugin": "1.4.1",
Expand Down
12 changes: 12 additions & 0 deletions test/acceptance/workspaces/pipenv-app-python-3.12/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
"Jinja2" = "*"

[dev-packages]

[requires]
python_version = "3.12"
46 changes: 46 additions & 0 deletions test/jest/acceptance/snyk-test/basic-test-all-languages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,52 @@ describe('`snyk test` of basic projects for each language/ecosystem', () => {
expect(result.stderr).toMatch(wrongPythonCommand);
});

test('run `snyk test` on a pipenv project', async () => {
const project = await createProjectFromWorkspace('pipenv-app');
let pythonCommand = 'python';

await runCommand(pythonCommand, ['--version']).catch(function() {
pythonCommand = 'python3';
});

const pipenvResult = await runCommand('pipenv', ['install'], {
shell: true,
cwd: project.path(),
});

expect(pipenvResult.code).toEqual(0);

const result = await runSnykCLI('test -d --command=' + pythonCommand, {
cwd: project.path(),
env,
});

expect(result.code).toEqual(0);
});

test('run `snyk test` on a pipenv python 3.12 project without setuptools installed', async () => {
const project = await createProjectFromWorkspace('pipenv-app-python-3.12');
let pythonCommand = 'python';

await runCommand(pythonCommand, ['--version']).catch(function() {
pythonCommand = 'python3';
});

const pipenvResult = await runCommand('pipenv', ['install'], {
shell: true,
cwd: project.path(),
});

expect(pipenvResult.code).toEqual(0);

const result = await runSnykCLI('test -d --command=' + pythonCommand, {
cwd: project.path(),
env,
});

expect(result.code).toEqual(0);
});

test('run `snyk test` on a gradle project', async () => {
const project = await createProjectFromWorkspace('gradle-app');

Expand Down

0 comments on commit 456944e

Please sign in to comment.