diff --git a/news/2 Fixes/9490.md b/news/2 Fixes/9490.md new file mode 100644 index 000000000000..c61cc3450333 --- /dev/null +++ b/news/2 Fixes/9490.md @@ -0,0 +1 @@ +Disable use of `conda run`. diff --git a/src/client/common/process/pythonExecutionFactory.ts b/src/client/common/process/pythonExecutionFactory.ts index 8626cd33c7ca..05498f1c2d45 100644 --- a/src/client/common/process/pythonExecutionFactory.ts +++ b/src/client/common/process/pythonExecutionFactory.ts @@ -52,17 +52,6 @@ export class PythonExecutionFactory implements IPythonExecutionFactory { const processLogger = this.serviceContainer.get(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); - 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); } @@ -128,16 +117,10 @@ export class PythonExecutionFactory implements IPythonExecutionFactory { processService.on('exec', processLogger.logProcess.bind(processLogger)); this.serviceContainer.get(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 { const processServicePromise = processService ? Promise.resolve(processService) : this.processServiceFactory.create(resource); const [condaVersion, condaEnvironment, condaFile, procService] = await Promise.all([ diff --git a/src/test/common/process/condaExecutionService.unit.test.ts b/src/test/common/process/condaExecutionService.unit.test.ts index 8ef07c408684..6956a17d333e 100644 --- a/src/test/common/process/condaExecutionService.unit.test.ts +++ b/src/test/common/process/condaExecutionService.unit.test.ts @@ -24,7 +24,10 @@ suite('CondaExecutionService', () => { serviceContainer.setup(s => s.get(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); @@ -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); diff --git a/src/test/common/process/pythonExecutionFactory.unit.test.ts b/src/test/common/process/pythonExecutionFactory.unit.test.ts index e857df37e4b9..86a3471ab00d 100644 --- a/src/test/common/process/pythonExecutionFactory.unit.test.ts +++ b/src/test/common/process/pythonExecutionFactory.unit.test.ts @@ -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); @@ -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); @@ -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); @@ -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';