Skip to content

Commit 4946e5c

Browse files
committed
When starting Jupyter activate conda env (#9972)
* If interpreter is provided use that to check if is conda environment * Fix tests For #9973 Currently conda isn't getting activated when auto starting Jupyter server.
1 parent 3976296 commit 4946e5c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/client/common/terminal/helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class TerminalHelper implements ITerminalHelper {
9393
}
9494

9595
// If we have a conda environment, then use that.
96-
const isCondaEnvironment = await this.condaService.isCondaEnvironment(settings.pythonPath);
96+
const isCondaEnvironment = interpreter ? interpreter.type === InterpreterType.Conda : await this.condaService.isCondaEnvironment(settings.pythonPath);
9797
if (isCondaEnvironment) {
9898
const activationCommands = interpreter
9999
? await this.conda.getActivationCommandsForInterpreter(interpreter.path, terminalShellType)

src/test/common/terminals/helper.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ suite('Terminal Service helpers', () => {
327327

328328
expect(cmd).to.equal(undefined, 'Command must be undefined');
329329
verify(pythonSettings.terminal).once();
330-
verify(pythonSettings.pythonPath).once();
331-
verify(condaService.isCondaEnvironment(pythonPath)).once();
330+
verify(pythonSettings.pythonPath).times(interpreter ? 0 : 1);
331+
verify(condaService.isCondaEnvironment(pythonPath)).times(interpreter ? 0 : 1);
332332
verify(bashActivationProvider.isShellSupported(shellToExpect)).atLeast(1);
333333
verify(pyenvActivationProvider.isShellSupported(anything())).never();
334334
verify(pipenvActivationProvider.isShellSupported(anything())).never();

0 commit comments

Comments
 (0)