diff --git a/news/2 Fixes/5171.md b/news/2 Fixes/5171.md new file mode 100644 index 000000000000..daf2063644ff --- /dev/null +++ b/news/2 Fixes/5171.md @@ -0,0 +1,2 @@ +Append `--pre` to black installation command so pipenv can properly resolve it. +(thanks [Erin O'Connell](https://github.com/erinxocon)) diff --git a/src/client/common/installer/pipEnvInstaller.ts b/src/client/common/installer/pipEnvInstaller.ts index 08947cb4cd3c..25a6cf5ab54b 100644 --- a/src/client/common/installer/pipEnvInstaller.ts +++ b/src/client/common/installer/pipEnvInstaller.ts @@ -31,8 +31,12 @@ export class PipEnvInstaller extends ModuleInstaller implements IModuleInstaller return interpreters && interpreters.length > 0; } protected async getExecutionInfo(moduleName: string, _resource?: Uri): Promise { + const args = ['install', moduleName, '--dev']; + if (moduleName === 'black') { + args.push('--pre'); + }; return { - args: ['install', moduleName, '--dev'], + args: args, execPath: pipenvName }; } diff --git a/src/test/common/installer/moduleInstaller.unit.test.ts b/src/test/common/installer/moduleInstaller.unit.test.ts index 78a11a2e7d0d..a86cd69bbedd 100644 --- a/src/test/common/installer/moduleInstaller.unit.test.ts +++ b/src/test/common/installer/moduleInstaller.unit.test.ts @@ -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); }); }