Skip to content

Commit

Permalink
Correct code and test the main scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Apr 9, 2019
1 parent 272b565 commit 230b5fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export class VirtualEnvironmentPrompt implements IExtensionActivationService {
protected hasUserDefinedPythonPath(resource?: Uri) {
const settings = this.workspaceService.getConfiguration('python', resource)!.inspect<string>('pythonPath')!;
return ((settings.workspaceFolderValue && settings.workspaceFolderValue !== 'python') ||
(settings.workspaceValue && settings.workspaceValue !== 'python') ||
(settings.globalValue && settings.globalValue !== 'python')) ? true : false;
(settings.workspaceValue && settings.workspaceValue !== 'python')) ? true : false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ suite('Virtual Environment Prompt', () => {
workspaceConfig.verifyAll();
});

test('User is notified if interpreter exists and python path is not specified in settings.json', async () => {
test('User is notified if interpreter exists and only python path to global interpreter is specified in settings', async () => {
const resource = Uri.file('a');
const interpreter1 = { path: 'path/to/interpreter1' };
const interpreter2 = { path: 'path/to/interpreter2' };
const settings = { workspaceFolderValue: 'python' };
const settings = { workspaceFolderValue: 'python', globalValue: 'path/to/globalInterpreter' };
const prompts = [InteractiveShiftEnterBanner.bannerLabelYes(), InteractiveShiftEnterBanner.bannerLabelNo(), Interpreters.doNotShowAgain()];
const notificationPromptEnabled = TypeMoq.Mock.ofType<IPersistentState<boolean>>();
const workspaceConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
Expand Down Expand Up @@ -213,9 +213,9 @@ suite('Virtual Environment Prompt', () => {
expectedResult: false
},
{
testName: 'Returns true when interpreter is provided in global setting',
testName: 'Returns false when interpreter is provided in global setting',
settings: { globalValue: 'path/to/interpreter' },
expectedResult: true
expectedResult: false
},
{
testName: 'Returns false when no python setting is provided',
Expand Down

0 comments on commit 230b5fe

Please sign in to comment.