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
1 change: 1 addition & 0 deletions news/2 Fixes/9490.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disable use of `conda run`.
21 changes: 2 additions & 19 deletions src/client/common/process/pythonExecutionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,6 @@ export class PythonExecutionFactory implements IPythonExecutionFactory {
const processLogger = this.serviceContainer.get<IProcessLogger>(IProcessLogger);
processService.on('exec', processLogger.logProcess.bind(processLogger));

// Don't bother getting a conda execution service instance if we haven't fetched the list of interpreters yet.
// Also, without this hasInterpreters check smoke tests will time out
const interpreterService = this.serviceContainer.get<IInterpreterService>(IInterpreterService);
const hasInterpreters = await interpreterService.hasInterpreters;
if (hasInterpreters) {
const condaExecutionService = await this.createCondaExecutionService(pythonPath, processService);
if (condaExecutionService) {
return condaExecutionService;
}
}

if (this.windowsStoreInterpreter.isWindowsStoreInterpreter(pythonPath)) {
return new WindowsStorePythonProcess(this.serviceContainer, processService, pythonPath, this.windowsStoreInterpreter);
}
Expand Down Expand Up @@ -128,16 +117,10 @@ export class PythonExecutionFactory implements IPythonExecutionFactory {
processService.on('exec', processLogger.logProcess.bind(processLogger));
this.serviceContainer.get<IDisposableRegistry>(IDisposableRegistry).push(processService);

// Allow parts of the code to ignore conda run.
if (!options.bypassCondaExecution) {
const condaExecutionService = await this.createCondaExecutionService(pythonPath, processService);
if (condaExecutionService) {
return condaExecutionService;
}
}

return new PythonExecutionService(this.serviceContainer, processService, pythonPath);
}
// Not using this function for now because there are breaking issues with conda run (conda 4.8, PVSC 2020.1).
// See https://github.com/microsoft/vscode-python/issues/9490
public async createCondaExecutionService(pythonPath: string, processService?: IProcessService, resource?: Uri): Promise<CondaExecutionService | undefined> {
const processServicePromise = processService ? Promise.resolve(processService) : this.processServiceFactory.create(resource);
const [condaVersion, condaEnvironment, condaFile, procService] = await Promise.all([
Expand Down
10 changes: 8 additions & 2 deletions src/test/common/process/condaExecutionService.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ suite('CondaExecutionService', () => {
serviceContainer.setup(s => s.get<IFileSystem>(IFileSystem)).returns(() => fileSystem.object);
});

test('getExecutionInfo with a named environment should return execution info using the environment name', () => {
test('getExecutionInfo with a named environment should return execution info using the environment name', function() {
// tslint:disable-next-line:no-invalid-this
return this.skip();

const environment = { name: 'foo', path: 'bar' };
executionService = new CondaExecutionService(serviceContainer.object, processService.object, pythonPath, condaFile, environment);

Expand All @@ -33,7 +36,10 @@ suite('CondaExecutionService', () => {
expect(result).to.deep.equal({ command: condaFile, args: ['run', '-n', environment.name, 'python', ...args] });
});

test('getExecutionInfo with a non-named environment should return execution info using the environment path', async () => {
test('getExecutionInfo with a non-named environment should return execution info using the environment path', async function() {
// tslint:disable-next-line:no-invalid-this
return this.skip();

const environment = { name: '', path: 'bar' };
executionService = new CondaExecutionService(serviceContainer.object, processService.object, pythonPath, condaFile, environment);

Expand Down
21 changes: 17 additions & 4 deletions src/test/common/process/pythonExecutionFactory.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ suite('Process - PythonExecutionFactory', () => {
expect(service).instanceOf(WindowsStorePythonProcess);
});

test('Ensure `create` returns a CondaExecutionService instance if createCondaExecutionService() returns a valid object', async () => {
test('Ensure `create` returns a CondaExecutionService instance if createCondaExecutionService() returns a valid object', async function() {
// tslint:disable-next-line:no-invalid-this
return this.skip();

const pythonPath = 'path/to/python';
const pythonSettings = mock(PythonSettings);

Expand All @@ -234,7 +237,10 @@ suite('Process - PythonExecutionFactory', () => {
expect(service).instanceOf(CondaExecutionService);
});

test('Ensure `create` returns a PythonExecutionService instance if createCondaExecutionService() returns undefined', async () => {
test('Ensure `create` returns a PythonExecutionService instance if createCondaExecutionService() returns undefined', async function() {
// tslint:disable-next-line:no-invalid-this
return this.skip();

const pythonPath = 'path/to/python';
const pythonSettings = mock(PythonSettings);
when(processFactory.create(resource)).thenResolve(processService.object);
Expand All @@ -253,7 +259,10 @@ suite('Process - PythonExecutionFactory', () => {
expect(service).instanceOf(PythonExecutionService);
});

test('Ensure `createActivatedEnvironment` returns a CondaExecutionService instance if createCondaExecutionService() returns a valid object', async () => {
test('Ensure `createActivatedEnvironment` returns a CondaExecutionService instance if createCondaExecutionService() returns a valid object', async function() {
// tslint:disable-next-line:no-invalid-this
return this.skip();

const pythonPath = 'path/to/python';
const pythonSettings = mock(PythonSettings);

Expand All @@ -272,13 +281,17 @@ suite('Process - PythonExecutionFactory', () => {
verify(pythonSettings.pythonPath).once();
verify(condaService.getCondaEnvironment(pythonPath)).once();
} else {
// @ts-ignore
verify(condaService.getCondaEnvironment(interpreter.path)).once();
}

expect(service).instanceOf(CondaExecutionService);
});

test('Ensure `createActivatedEnvironment` returns a PythonExecutionService instance if createCondaExecutionService() returns undefined', async () => {
test('Ensure `createActivatedEnvironment` returns a PythonExecutionService instance if createCondaExecutionService() returns undefined', async function() {
// tslint:disable-next-line:no-invalid-this
return this.skip();

let createInvoked = false;
const pythonPath = 'path/to/python';
const mockExecService = 'mockService';
Expand Down