Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/common/process/pythonExecutionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export class PythonExecutionFactory implements IPythonExecutionFactory {
);
}
}
pythonPath = this.configService.getSettings(options.resource).pythonPath;
}
pythonPath = this.configService.getSettings(options.resource).pythonPath;
const processService: IProcessService = await this.processServiceFactory.create(options.resource);
processService.on('exec', this.logger.logProcess.bind(this.logger));

Expand Down
17 changes: 17 additions & 0 deletions src/test/common/process/pythonExecutionFactory.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,23 @@ suite('Process - PythonExecutionFactory', () => {
verify(pythonSettings.pythonPath).once();
});

test('If interpreter is explicitly set, ensure we use it', async () => {
const pythonSettings = mock(PythonSettings);
when(processFactory.create(resource)).thenResolve(processService.object);
inDiscoveryExperimentStub.resolves(true);
when(activationHelper.getActivatedEnvironmentVariables(resource)).thenResolve({ x: '1' });
reset(interpreterPathExpHelper);
when(interpreterPathExpHelper.get(anything())).thenReturn('python');
when(autoSelection.autoSelectInterpreter(anything())).thenResolve();
when(configService.getSettings(resource)).thenReturn(instance(pythonSettings));

const service = await factory.create({ resource, pythonPath: 'HELLO' });

expect(service).to.not.equal(undefined);
verify(pyenvs.isWindowsStoreInterpreter('HELLO')).once();
verify(pythonSettings.pythonPath).never();
});

test('If no interpreter is explicitly set, ensure we autoselect before PythonExecutionService is created', async () => {
const pythonSettings = mock(PythonSettings);
when(processFactory.create(resource)).thenResolve(processService.object);
Expand Down