diff --git a/packages/snyk-fix/src/plugins/python/handlers/pip-requirements/is-supported.ts b/packages/snyk-fix/src/plugins/python/handlers/pip-requirements/is-supported.ts index 25ce4b9cff..35f14f2913 100644 --- a/packages/snyk-fix/src/plugins/python/handlers/pip-requirements/is-supported.ts +++ b/packages/snyk-fix/src/plugins/python/handlers/pip-requirements/is-supported.ts @@ -45,11 +45,13 @@ export async function isSupported( }; } - const { containsRequire } = await containsRequireDirective(requirementsTxt); - if (containsRequire) { + const { containsRequire, matches } = await containsRequireDirective( + requirementsTxt, + ); + if (containsRequire && matches.some((m) => m.includes('c'))) { return { supported: false, - reason: `Requirements with ${chalk.bold('-r')} or ${chalk.bold( + reason: `Requirements with ${chalk.bold( '-c', )} directive are not yet supported`, }; diff --git a/packages/snyk-fix/test/acceptance/plugins/python/update-dependencies/update-dependencies.spec.ts b/packages/snyk-fix/test/acceptance/plugins/python/update-dependencies/update-dependencies.spec.ts index 04fe080ad0..a637ca42f8 100644 --- a/packages/snyk-fix/test/acceptance/plugins/python/update-dependencies/update-dependencies.spec.ts +++ b/packages/snyk-fix/test/acceptance/plugins/python/update-dependencies/update-dependencies.spec.ts @@ -12,7 +12,8 @@ describe('fix *req*.txt / *.txt Python projects', () => { filesToDelete.map((f) => fs.unlinkSync(f)); }); const workspacesPath = pathLib.resolve(__dirname, 'workspaces'); - it('skips projects with a -r option', async () => { + + it('fixes project with a -r option', async () => { // Arrange const targetFile = 'with-require/dev.txt'; @@ -72,15 +73,22 @@ describe('fix *req*.txt / *.txt Python projects', () => { results: { python: { failed: [], - skipped: [ + skipped: [], + succeeded: [ { original: entityToFix, - userMessage: expect.stringContaining( - 'directive are not yet supported', - ), + changes: [ + { + success: true, + userMessage: 'Pinned transitive from 1.0.0 to 1.1.1', + }, + { + success: true, + userMessage: 'Upgraded Django from 1.6.1 to 2.0.1', + }, + ], }, ], - succeeded: [], }, }, }); diff --git a/packages/snyk-fix/test/unit/plugins/python/is-supported.ts b/packages/snyk-fix/test/unit/plugins/python/is-supported.spec.ts similarity index 92% rename from packages/snyk-fix/test/unit/plugins/python/is-supported.ts rename to packages/snyk-fix/test/unit/plugins/python/is-supported.spec.ts index fbb2210090..24cc508b40 100644 --- a/packages/snyk-fix/test/unit/plugins/python/is-supported.ts +++ b/packages/snyk-fix/test/unit/plugins/python/is-supported.spec.ts @@ -13,14 +13,14 @@ describe('isSupported', () => { const res = await isSupported(entity); expect(res.supported).toBeFalsy(); }); - it('with -r directive in the manifest not supported', async () => { + it('with -r directive in the manifest is supported', async () => { const entity = generateEntityToFix( 'pip', 'requirements.txt', '-r prod.txt\nDjango==1.6.1', ); const res = await isSupported(entity); - expect(res.supported).toBeFalsy(); + expect(res.supported).toBeTruthy(); }); it('with -c directive in the manifest not supported', async () => { const entity = generateEntityToFix(