Skip to content

Commit

Permalink
Append --pre to black installation command when pipenv is used (#5393)
Browse files Browse the repository at this point in the history
* if black is being installed, append pre 
This is so it can be resolved correctly by pipenv
* extra extra read all about it!
update news
* if black is being installed make sure we pass --pre
* Thank author of PR
  • Loading branch information
erinxocon authored and DonJayamanne committed Apr 25, 2019
1 parent a215b5d commit 6dbd8b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions news/2 Fixes/5171.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Append `--pre` to black installation command so pipenv can properly resolve it.
(thanks [Erin O'Connell](https://github.com/erinxocon))
6 changes: 5 additions & 1 deletion src/client/common/installer/pipEnvInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ export class PipEnvInstaller extends ModuleInstaller implements IModuleInstaller
return interpreters && interpreters.length > 0;
}
protected async getExecutionInfo(moduleName: string, _resource?: Uri): Promise<ExecutionInfo> {
const args = ['install', moduleName, '--dev'];
if (moduleName === 'black') {
args.push('--pre');
};
return {
args: ['install', moduleName, '--dev'],
args: args,
execPath: pipenvName
};
}
Expand Down
3 changes: 3 additions & 0 deletions src/test/common/installer/moduleInstaller.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ suite('Module Installer', () => {
test(`Test args (${product.name})`, async () => {
setActiveInterpreter();
const expectedArgs = ['install', moduleName, '--dev'];
if (moduleName === 'black') {
expectedArgs.push('--pre')
}
await installModuleAndVerifyCommand(pipenvName, expectedArgs);
});
}
Expand Down

0 comments on commit 6dbd8b6

Please sign in to comment.