From 7c17a1a8653eebc73f6141b2e107abd8d8bb862b Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 13:45:18 -0700 Subject: [PATCH 01/11] Add the "python.pipenvPath" config setting. --- package.json | 6 ++++++ src/client/common/configSettings.ts | 3 +++ src/client/common/types.ts | 1 + 3 files changed, 10 insertions(+) diff --git a/package.json b/package.json index 30c2095b5463..ab098a8382d0 100644 --- a/package.json +++ b/package.json @@ -1521,6 +1521,12 @@ "description": "Path to the conda executable to use for activation (version 4.4+).", "scope": "resource" }, + "python.pipenvPath": { + "type": "string", + "default": "", + "description": "Path to the pipenv executable to use for activation.", + "scope": "resource" + }, "python.sortImports.args": { "type": "array", "description": "Arguments passed in. Each argument is a separate item in the array.", diff --git a/src/client/common/configSettings.ts b/src/client/common/configSettings.ts index b10c7ad0c686..61e12abbdd7c 100644 --- a/src/client/common/configSettings.ts +++ b/src/client/common/configSettings.ts @@ -40,6 +40,7 @@ export class PythonSettings extends EventEmitter implements IPythonSettings { public venvPath = ''; public venvFolders: string[] = []; public condaPath = ''; + public pipenvPath = ''; public devOptions: string[] = []; public linting!: ILintingSettings; public formatting!: IFormattingSettings; @@ -137,6 +138,8 @@ export class PythonSettings extends EventEmitter implements IPythonSettings { this.venvFolders = systemVariables.resolveAny(pythonSettings.get('venvFolders'))!; const condaPath = systemVariables.resolveAny(pythonSettings.get('condaPath'))!; this.condaPath = condaPath && condaPath.length > 0 ? getAbsolutePath(condaPath, workspaceRoot) : condaPath; + const pipenvPath = systemVariables.resolveAny(pythonSettings.get('pipenvPath'))!; + this.pipenvPath = pipenvPath && pipenvPath.length > 0 ? getAbsolutePath(pipenvPath, workspaceRoot) : pipenvPath; this.downloadLanguageServer = systemVariables.resolveAny(pythonSettings.get('downloadLanguageServer', true))!; this.jediEnabled = systemVariables.resolveAny(pythonSettings.get('jediEnabled', true))!; diff --git a/src/client/common/types.ts b/src/client/common/types.ts index 3d8ad02b97a1..039a41e4d871 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -141,6 +141,7 @@ export interface IPythonSettings { readonly venvPath: string; readonly venvFolders: string[]; readonly condaPath: string; + readonly pipenvPath: string; readonly downloadLanguageServer: boolean; readonly jediEnabled: boolean; readonly jediPath: string; From 41f50e404f2906241cd13e994f3c68a924fe50d8 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 14:05:52 -0700 Subject: [PATCH 02/11] Use the "python.pipenvPath" setting if set. --- .../locators/services/pipEnvService.ts | 23 +++++++++++-- .../interpreters/pipEnvService.unit.test.ts | 33 +++++++++++++++++-- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/client/interpreter/locators/services/pipEnvService.ts b/src/client/interpreter/locators/services/pipEnvService.ts index fde8f6f69746..e2ae3ec9e72e 100644 --- a/src/client/interpreter/locators/services/pipEnvService.ts +++ b/src/client/interpreter/locators/services/pipEnvService.ts @@ -8,12 +8,12 @@ import { IApplicationShell, IWorkspaceService } from '../../../common/applicatio import { traceError } from '../../../common/logger'; import { IFileSystem, IPlatformService } from '../../../common/platform/types'; import { IProcessServiceFactory } from '../../../common/process/types'; -import { ICurrentProcess, ILogger } from '../../../common/types'; +import { IConfigurationService, ICurrentProcess, ILogger } from '../../../common/types'; import { IServiceContainer } from '../../../ioc/types'; import { IInterpreterHelper, InterpreterType, IPipEnvService, PythonInterpreter } from '../../contracts'; import { CacheableLocatorService } from './cacheableLocatorService'; -const execName = 'pipenv'; +const DefaultExecName = 'pipenv'; const pipEnvFileNameVariable = 'PIPENV_PIPFILE'; @injectable() @@ -23,6 +23,7 @@ export class PipEnvService extends CacheableLocatorService implements IPipEnvSer private readonly workspace: IWorkspaceService; private readonly fs: IFileSystem; private readonly logger: ILogger; + private readonly configService: IConfigurationService; constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) { super('PipEnvService', serviceContainer); @@ -31,6 +32,7 @@ export class PipEnvService extends CacheableLocatorService implements IPipEnvSer this.workspace = this.serviceContainer.get(IWorkspaceService); this.fs = this.serviceContainer.get(IFileSystem); this.logger = this.serviceContainer.get(ILogger); + this.configService = this.serviceContainer.get(IConfigurationService); } // tslint:disable-next-line:no-empty public dispose() { } @@ -42,6 +44,22 @@ export class PipEnvService extends CacheableLocatorService implements IPipEnvSer const envName = await this.getInterpreterPathFromPipenv(dir, true); return !!envName; } + + public getExecutable(): string { + try { + const settings = this.configService.getSettings(); + const setting = settings.pipenvPath; + if (setting && setting !== '') { + return setting; + } + } catch (exc) { + traceError('settings.pipenvPath lookup failed', exc); + // Fall back to the default. + } + + return DefaultExecName; + } + protected getInterpretersImplementation(resource?: Uri): Promise { const pipenvCwd = this.getPipenvWorkingDirectory(resource); if (!pipenvCwd) { @@ -115,6 +133,7 @@ export class PipEnvService extends CacheableLocatorService implements IPipEnvSer private async invokePipenv(arg: string, rootPath: string): Promise { try { const processService = await this.processServiceFactory.create(Uri.file(rootPath)); + const execName = this.getExecutable().toCommandArgument(); const result = await processService.exec(execName, [arg], { cwd: rootPath }); if (result) { const stdout = result.stdout ? result.stdout.trim() : ''; diff --git a/src/test/interpreters/pipEnvService.unit.test.ts b/src/test/interpreters/pipEnvService.unit.test.ts index 84d9069e05e5..383628d8780e 100644 --- a/src/test/interpreters/pipEnvService.unit.test.ts +++ b/src/test/interpreters/pipEnvService.unit.test.ts @@ -5,6 +5,7 @@ // tslint:disable:max-func-body-length no-any +import * as assert from 'assert'; import { expect } from 'chai'; import * as path from 'path'; import { SemVer } from 'semver'; @@ -13,10 +14,17 @@ import { Uri, WorkspaceFolder } from 'vscode'; import { IApplicationShell, IWorkspaceService } from '../../client/common/application/types'; import { IFileSystem, IPlatformService } from '../../client/common/platform/types'; import { IProcessService, IProcessServiceFactory } from '../../client/common/process/types'; -import { ICurrentProcess, ILogger, IPersistentState, IPersistentStateFactory } from '../../client/common/types'; +import { + IConfigurationService, + ICurrentProcess, + ILogger, + IPersistentState, + IPersistentStateFactory, + IPythonSettings +} from '../../client/common/types'; import { getNamesAndValues } from '../../client/common/utils/enum'; import { IEnvironmentVariablesProvider } from '../../client/common/variables/types'; -import { IInterpreterHelper, IInterpreterLocatorService } from '../../client/interpreter/contracts'; +import { IInterpreterHelper } from '../../client/interpreter/contracts'; import { PipEnvService } from '../../client/interpreter/locators/services/pipEnvService'; import { IServiceContainer } from '../../client/ioc/types'; @@ -30,7 +38,7 @@ suite('Interpreters - PipEnv', () => { [undefined, Uri.file(path.join(rootWorkspace, 'one.py'))].forEach(resource => { const testSuffix = ` (${os.name}, ${resource ? 'with' : 'without'} a workspace)`; - let pipEnvService: IInterpreterLocatorService; + let pipEnvService: PipEnvService; let serviceContainer: TypeMoq.IMock; let interpreterHelper: TypeMoq.IMock; let processService: TypeMoq.IMock; @@ -42,6 +50,9 @@ suite('Interpreters - PipEnv', () => { let procServiceFactory: TypeMoq.IMock; let logger: TypeMoq.IMock; let platformService: TypeMoq.IMock; + let config: TypeMoq.IMock; + let settings: TypeMoq.IMock; + let pipenvPathSetting: string; setup(() => { serviceContainer = TypeMoq.Mock.ofType(); const workspaceService = TypeMoq.Mock.ofType(); @@ -80,6 +91,12 @@ suite('Interpreters - PipEnv', () => { serviceContainer.setup(c => c.get(TypeMoq.It.isValue(IEnvironmentVariablesProvider))).returns(() => envVarsProvider.object); serviceContainer.setup(c => c.get(TypeMoq.It.isValue(ILogger))).returns(() => logger.object); serviceContainer.setup(c => c.get(TypeMoq.It.isValue(IPlatformService))).returns(() => platformService.object); + serviceContainer.setup(c => c.get(TypeMoq.It.isValue(IConfigurationService), TypeMoq.It.isAny())).returns(() => config.object); + + config = TypeMoq.Mock.ofType(); + settings = TypeMoq.Mock.ofType(); + config.setup(c => c.getSettings(TypeMoq.It.isValue(undefined))).returns(() => settings.object); + settings.setup(p => p.pipenvPath).returns(() => pipenvPathSetting); pipEnvService = new PipEnvService(serviceContainer.object); }); @@ -156,6 +173,16 @@ suite('Interpreters - PipEnv', () => { expect(environments).to.be.lengthOf(1); fileSystem.verifyAll(); }); + test('Must use \'python.pipenvPath\' setting if set', async () => { + pipenvPathSetting = 'spam-spam-pipenv-spam-spam'; + const pipenvExe = pipEnvService.getExecutable(); + assert.equal(pipenvExe, 'spam-spam-pipenv-spam-spam', 'Failed to identify pipenv.exe'); + }); + test('Must use default if \'python.pipenvPath\' setting not set', async () => { + pipenvPathSetting = ''; + const pipenvExe = pipEnvService.getExecutable(); + assert.equal(pipenvExe, 'pipenv', 'Failed to identify pipenv.exe'); + }); }); }); }); From a961fcd80e1697b15aa70350c6db4b88465be160 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 14:26:16 -0700 Subject: [PATCH 03/11] Add a NEWS entry. --- news/1 Enhancements/978.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/1 Enhancements/978.md diff --git a/news/1 Enhancements/978.md b/news/1 Enhancements/978.md new file mode 100644 index 000000000000..544d85669309 --- /dev/null +++ b/news/1 Enhancements/978.md @@ -0,0 +1 @@ +Add the python.pipenvPath config setting. From 8c74fdf8ed6536beb229a0aaf494a401a7fc2ab3 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 15:11:49 -0700 Subject: [PATCH 04/11] Add pipenvPath to the config tests. --- src/test/common/configSettings/configSettings.unit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/common/configSettings/configSettings.unit.test.ts b/src/test/common/configSettings/configSettings.unit.test.ts index e571f73ed049..61a494d51a73 100644 --- a/src/test/common/configSettings/configSettings.unit.test.ts +++ b/src/test/common/configSettings/configSettings.unit.test.ts @@ -46,7 +46,7 @@ suite('Python Settings', () => { function initializeConfig(sourceSettings: PythonSettings) { // string settings - for (const name of ['pythonPath', 'venvPath', 'condaPath', 'envFile']) { + for (const name of ['pythonPath', 'venvPath', 'condaPath', 'pipenvPath', 'envFile']) { config.setup(c => c.get(name)) .returns(() => sourceSettings[name]); } From 92efb4fe33c8fb135a1b7f617587754a3954198e Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 16:21:08 -0700 Subject: [PATCH 05/11] Nothing in getExecutable() can fail. --- .../interpreter/locators/services/pipEnvService.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/client/interpreter/locators/services/pipEnvService.ts b/src/client/interpreter/locators/services/pipEnvService.ts index e2ae3ec9e72e..8de14ce69be9 100644 --- a/src/client/interpreter/locators/services/pipEnvService.ts +++ b/src/client/interpreter/locators/services/pipEnvService.ts @@ -46,17 +46,11 @@ export class PipEnvService extends CacheableLocatorService implements IPipEnvSer } public getExecutable(): string { - try { - const settings = this.configService.getSettings(); - const setting = settings.pipenvPath; - if (setting && setting !== '') { - return setting; - } - } catch (exc) { - traceError('settings.pipenvPath lookup failed', exc); - // Fall back to the default. + const settings = this.configService.getSettings(); + const setting = settings.pipenvPath; + if (setting && setting !== '') { + return setting; } - return DefaultExecName; } From e61b9ed984d25aa16a17895516fa44962db6d25f Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 16:28:27 -0700 Subject: [PATCH 06/11] Turn getExecutable() into a property. --- src/client/interpreter/locators/services/pipEnvService.ts | 4 ++-- src/test/interpreters/pipEnvService.unit.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client/interpreter/locators/services/pipEnvService.ts b/src/client/interpreter/locators/services/pipEnvService.ts index 8de14ce69be9..9a2f5d837f6b 100644 --- a/src/client/interpreter/locators/services/pipEnvService.ts +++ b/src/client/interpreter/locators/services/pipEnvService.ts @@ -45,7 +45,7 @@ export class PipEnvService extends CacheableLocatorService implements IPipEnvSer return !!envName; } - public getExecutable(): string { + public get executable(): string { const settings = this.configService.getSettings(); const setting = settings.pipenvPath; if (setting && setting !== '') { @@ -127,7 +127,7 @@ export class PipEnvService extends CacheableLocatorService implements IPipEnvSer private async invokePipenv(arg: string, rootPath: string): Promise { try { const processService = await this.processServiceFactory.create(Uri.file(rootPath)); - const execName = this.getExecutable().toCommandArgument(); + const execName = this.executable.toCommandArgument(); const result = await processService.exec(execName, [arg], { cwd: rootPath }); if (result) { const stdout = result.stdout ? result.stdout.trim() : ''; diff --git a/src/test/interpreters/pipEnvService.unit.test.ts b/src/test/interpreters/pipEnvService.unit.test.ts index 383628d8780e..2bf65a49eaa2 100644 --- a/src/test/interpreters/pipEnvService.unit.test.ts +++ b/src/test/interpreters/pipEnvService.unit.test.ts @@ -175,12 +175,12 @@ suite('Interpreters - PipEnv', () => { }); test('Must use \'python.pipenvPath\' setting if set', async () => { pipenvPathSetting = 'spam-spam-pipenv-spam-spam'; - const pipenvExe = pipEnvService.getExecutable(); + const pipenvExe = pipEnvService.executable; assert.equal(pipenvExe, 'spam-spam-pipenv-spam-spam', 'Failed to identify pipenv.exe'); }); test('Must use default if \'python.pipenvPath\' setting not set', async () => { pipenvPathSetting = ''; - const pipenvExe = pipEnvService.getExecutable(); + const pipenvExe = pipEnvService.executable; assert.equal(pipenvExe, 'pipenv', 'Failed to identify pipenv.exe'); }); }); From 57272fb6cd5662087d5cb147ed760a9bb8798f37 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 16:37:01 -0700 Subject: [PATCH 07/11] Set a default for the pipenvPath setting. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ab098a8382d0..7f2b3f96a20b 100644 --- a/package.json +++ b/package.json @@ -1523,7 +1523,7 @@ }, "python.pipenvPath": { "type": "string", - "default": "", + "default": "pipenv", "description": "Path to the pipenv executable to use for activation.", "scope": "resource" }, From 04363f0bb9a49b3118db9a1b494b707f2cf08575 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 16:39:36 -0700 Subject: [PATCH 08/11] Do not escape the executable name. --- src/client/interpreter/locators/services/pipEnvService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/interpreter/locators/services/pipEnvService.ts b/src/client/interpreter/locators/services/pipEnvService.ts index 9a2f5d837f6b..f3eec147370f 100644 --- a/src/client/interpreter/locators/services/pipEnvService.ts +++ b/src/client/interpreter/locators/services/pipEnvService.ts @@ -127,7 +127,7 @@ export class PipEnvService extends CacheableLocatorService implements IPipEnvSer private async invokePipenv(arg: string, rootPath: string): Promise { try { const processService = await this.processServiceFactory.create(Uri.file(rootPath)); - const execName = this.executable.toCommandArgument(); + const execName = this.executable; const result = await processService.exec(execName, [arg], { cwd: rootPath }); if (result) { const stdout = result.stdout ? result.stdout.trim() : ''; From 5213c276b49ef63c0cc0bc88b6b7ceb13317dfe7 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 17:08:15 -0700 Subject: [PATCH 09/11] Use the config setting in the activation provider. --- .../pipEnvActivationProvider.ts | 10 +++++++--- src/client/interpreter/contracts.ts | 1 + .../pipEnvActivationProvider.unit.test.ts | 12 ++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/client/common/terminal/environmentActivationProviders/pipEnvActivationProvider.ts b/src/client/common/terminal/environmentActivationProviders/pipEnvActivationProvider.ts index b279c00de109..be61c16ccbda 100644 --- a/src/client/common/terminal/environmentActivationProviders/pipEnvActivationProvider.ts +++ b/src/client/common/terminal/environmentActivationProviders/pipEnvActivationProvider.ts @@ -5,12 +5,15 @@ import { inject, injectable } from 'inversify'; import { Uri } from 'vscode'; -import { IInterpreterService, InterpreterType } from '../../../interpreter/contracts'; +import { IInterpreterService, InterpreterType, IPipEnvService } from '../../../interpreter/contracts'; import { ITerminalActivationCommandProvider, TerminalShellType } from '../types'; @injectable() export class PipEnvActivationCommandProvider implements ITerminalActivationCommandProvider { - constructor(@inject(IInterpreterService) private readonly interpreterService: IInterpreterService) { } + constructor( + @inject(IInterpreterService) private readonly interpreterService: IInterpreterService, + @inject(IPipEnvService) private readonly pipenvService: IPipEnvService + ) { } public isShellSupported(_targetShell: TerminalShellType): boolean { return true; @@ -22,6 +25,7 @@ export class PipEnvActivationCommandProvider implements ITerminalActivationComma return; } - return ['pipenv shell']; + const execName = this.pipenvService.executable; + return [`${execName} shell`]; } } diff --git a/src/client/interpreter/contracts.ts b/src/client/interpreter/contracts.ts index f8db9ad82ba9..3ce2db2e75d7 100644 --- a/src/client/interpreter/contracts.ts +++ b/src/client/interpreter/contracts.ts @@ -113,6 +113,7 @@ export interface IInterpreterHelper { export const IPipEnvService = Symbol('IPipEnvService'); export interface IPipEnvService { + executable: string; isRelatedPipEnvironment(dir: string, pythonPath: string): Promise; } diff --git a/src/test/common/terminals/environmentActivationProviders/pipEnvActivationProvider.unit.test.ts b/src/test/common/terminals/environmentActivationProviders/pipEnvActivationProvider.unit.test.ts index de6ceba62116..4b42cfe9d1c1 100644 --- a/src/test/common/terminals/environmentActivationProviders/pipEnvActivationProvider.unit.test.ts +++ b/src/test/common/terminals/environmentActivationProviders/pipEnvActivationProvider.unit.test.ts @@ -5,11 +5,12 @@ import * as assert from 'assert'; import { instance, mock, when } from 'ts-mockito'; +import * as TypeMoq from 'typemoq'; import { Uri } from 'vscode'; import { PipEnvActivationCommandProvider } from '../../../../client/common/terminal/environmentActivationProviders/pipEnvActivationProvider'; import { ITerminalActivationCommandProvider, TerminalShellType } from '../../../../client/common/terminal/types'; import { getNamesAndValues } from '../../../../client/common/utils/enum'; -import { IInterpreterService, InterpreterType } from '../../../../client/interpreter/contracts'; +import { IInterpreterService, InterpreterType, IPipEnvService } from '../../../../client/interpreter/contracts'; import { InterpreterService } from '../../../../client/interpreter/interpreterService'; // tslint:disable:no-any @@ -19,9 +20,16 @@ suite('Terminals Activation - Pipenv', () => { suite(resource ? 'With a resource' : 'Without a resource', () => { let activationProvider: ITerminalActivationCommandProvider; let interpreterService: IInterpreterService; + let pipenvService: TypeMoq.IMock; setup(() => { interpreterService = mock(InterpreterService); - activationProvider = new PipEnvActivationCommandProvider(instance(interpreterService)); + pipenvService = TypeMoq.Mock.ofType(); + activationProvider = new PipEnvActivationCommandProvider( + instance(interpreterService), + pipenvService.object + ); + + pipenvService.setup(p => p.executable).returns(() => 'pipenv'); }); test('No commands for no interpreter', async () => { From d3c458f2689266801bc37f328a776f3cf48c9986 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 17:12:11 -0700 Subject: [PATCH 10/11] Make pipenvPath a global-only setting. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7f2b3f96a20b..b384fb155399 100644 --- a/package.json +++ b/package.json @@ -1525,7 +1525,7 @@ "type": "string", "default": "pipenv", "description": "Path to the pipenv executable to use for activation.", - "scope": "resource" + "scope": "window" }, "python.sortImports.args": { "type": "array", From 565483bf56a69a8205fa877d92cd01a6fb7c4c96 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Jan 2019 17:16:38 -0700 Subject: [PATCH 11/11] Rely on the default config value. --- src/client/interpreter/locators/services/pipEnvService.ts | 8 +------- src/test/interpreters/pipEnvService.unit.test.ts | 8 ++------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/client/interpreter/locators/services/pipEnvService.ts b/src/client/interpreter/locators/services/pipEnvService.ts index f3eec147370f..ede53aaaaf5c 100644 --- a/src/client/interpreter/locators/services/pipEnvService.ts +++ b/src/client/interpreter/locators/services/pipEnvService.ts @@ -13,7 +13,6 @@ import { IServiceContainer } from '../../../ioc/types'; import { IInterpreterHelper, InterpreterType, IPipEnvService, PythonInterpreter } from '../../contracts'; import { CacheableLocatorService } from './cacheableLocatorService'; -const DefaultExecName = 'pipenv'; const pipEnvFileNameVariable = 'PIPENV_PIPFILE'; @injectable() @@ -46,12 +45,7 @@ export class PipEnvService extends CacheableLocatorService implements IPipEnvSer } public get executable(): string { - const settings = this.configService.getSettings(); - const setting = settings.pipenvPath; - if (setting && setting !== '') { - return setting; - } - return DefaultExecName; + return this.configService.getSettings().pipenvPath; } protected getInterpretersImplementation(resource?: Uri): Promise { diff --git a/src/test/interpreters/pipEnvService.unit.test.ts b/src/test/interpreters/pipEnvService.unit.test.ts index 2bf65a49eaa2..70591d98fc2a 100644 --- a/src/test/interpreters/pipEnvService.unit.test.ts +++ b/src/test/interpreters/pipEnvService.unit.test.ts @@ -97,6 +97,7 @@ suite('Interpreters - PipEnv', () => { settings = TypeMoq.Mock.ofType(); config.setup(c => c.getSettings(TypeMoq.It.isValue(undefined))).returns(() => settings.object); settings.setup(p => p.pipenvPath).returns(() => pipenvPathSetting); + pipenvPathSetting = 'pipenv'; pipEnvService = new PipEnvService(serviceContainer.object); }); @@ -173,16 +174,11 @@ suite('Interpreters - PipEnv', () => { expect(environments).to.be.lengthOf(1); fileSystem.verifyAll(); }); - test('Must use \'python.pipenvPath\' setting if set', async () => { + test('Must use \'python.pipenvPath\' setting', async () => { pipenvPathSetting = 'spam-spam-pipenv-spam-spam'; const pipenvExe = pipEnvService.executable; assert.equal(pipenvExe, 'spam-spam-pipenv-spam-spam', 'Failed to identify pipenv.exe'); }); - test('Must use default if \'python.pipenvPath\' setting not set', async () => { - pipenvPathSetting = ''; - const pipenvExe = pipEnvService.executable; - assert.equal(pipenvExe, 'pipenv', 'Failed to identify pipenv.exe'); - }); }); }); });