Skip to content

Commit 4b3dff0

Browse files
author
Kartik Raj
authored
Fix bug with autoselection (#11185)
1 parent 02ff345 commit 4b3dff0

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

src/client/interpreter/autoSelection/index.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,6 @@ export class InterpreterAutoSelectionService implements IInterpreterAutoSelectio
135135
return this.globallyPreferredInterpreter.value;
136136
}
137137
public async setWorkspaceInterpreter(resource: Uri, interpreter: PythonInterpreter | undefined) {
138-
// We can only update the stored interpreter once we have done the necessary
139-
// work of auto selecting the interpreters.
140-
if (
141-
!this.autoSelectedWorkspacePromises.has(this.getWorkspacePathKey(resource)) ||
142-
!this.autoSelectedWorkspacePromises.get(this.getWorkspacePathKey(resource))!.completed
143-
) {
144-
return;
145-
}
146-
147138
await this.storeAutoSelectedInterpreter(resource, interpreter);
148139
}
149140
public async setGlobalInterpreter(interpreter: PythonInterpreter) {

src/test/interpreters/autoSelection/index.unit.test.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -319,26 +319,6 @@ suite('Interpreters - Auto Selection', () => {
319319
expect(selectedInterpreter).to.deep.equal(interpreterInfo);
320320
expect(eventFired).to.deep.equal(false, 'event fired');
321321
});
322-
test('Storing workspace interpreter info in state store should fail', async () => {
323-
const pythonPath = 'Hello World';
324-
const interpreterInfo = { path: pythonPath } as any;
325-
const resource = Uri.parse('one');
326-
when(
327-
stateFactory.createGlobalPersistentState<PythonInterpreter | undefined>(
328-
preferredGlobalInterpreter,
329-
undefined
330-
)
331-
).thenReturn(instance(state));
332-
when(workspaceService.getWorkspaceFolder(resource)).thenReturn({ name: '', index: 0, uri: resource });
333-
when(workspaceService.getWorkspaceFolderIdentifier(anything(), anything())).thenReturn('');
334-
335-
await autoSelectionService.initializeStore(undefined);
336-
await autoSelectionService.setWorkspaceInterpreter(resource, interpreterInfo);
337-
const selectedInterpreter = autoSelectionService.getAutoSelectedInterpreter(resource);
338-
339-
verify(state.updateValue(interpreterInfo)).never();
340-
expect(selectedInterpreter ? selectedInterpreter : undefined).to.deep.equal(undefined, 'not undefined');
341-
});
342322
test('Store workspace interpreter info in state store', async () => {
343323
const pythonPath = 'Hello World';
344324
const interpreterInfo = { path: pythonPath } as any;

0 commit comments

Comments
 (0)