From fbd54c26c29a2bb57f3d3ceaa4db881b47f05b1e Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Sun, 8 Dec 2024 21:09:29 -0800 Subject: [PATCH 1/9] use sendText for inside Python3.13 REPL --- src/client/common/terminal/service.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/client/common/terminal/service.ts b/src/client/common/terminal/service.ts index e37539f1bc7c..1fef20b0c8f3 100644 --- a/src/client/common/terminal/service.ts +++ b/src/client/common/terminal/service.ts @@ -102,10 +102,22 @@ export class TerminalService implements ITerminalService, Disposable { }); await promise; } - + // TODO: need to use sendText for Python3.13 as well. const config = getConfiguration('python'); const pythonrcSetting = config.get('terminal.shellIntegration.enabled'); - if ((isPythonShell && !pythonrcSetting) || (isPythonShell && isWindows())) { + + const pythonPath = this.serviceContainer + .get(IConfigurationService) + .getSettings(this.options?.resource).pythonPath; + const interpreterInfo = + this.options?.interpreter || + (await this.serviceContainer + .get(IInterpreterService) + .getInterpreterDetails(pythonPath)); + const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; + const isPython313 = pythonVersion?.startsWith('3.13'); + + if (isPythonShell && (!pythonrcSetting || isWindows() || isWsl() || isPython313)) { // If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL. terminal.sendText(commandLine); return undefined; From 8580b2099bb38edffd78228cbfb7e4f5e53c492a Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Sun, 8 Dec 2024 21:18:38 -0800 Subject: [PATCH 2/9] clean up --- src/client/common/terminal/service.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client/common/terminal/service.ts b/src/client/common/terminal/service.ts index 1fef20b0c8f3..5be7aed6fadc 100644 --- a/src/client/common/terminal/service.ts +++ b/src/client/common/terminal/service.ts @@ -102,7 +102,6 @@ export class TerminalService implements ITerminalService, Disposable { }); await promise; } - // TODO: need to use sendText for Python3.13 as well. const config = getConfiguration('python'); const pythonrcSetting = config.get('terminal.shellIntegration.enabled'); @@ -117,7 +116,7 @@ export class TerminalService implements ITerminalService, Disposable { const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; const isPython313 = pythonVersion?.startsWith('3.13'); - if (isPythonShell && (!pythonrcSetting || isWindows() || isWsl() || isPython313)) { + if (isPythonShell && (!pythonrcSetting || isWindows() || isPython313)) { // If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL. terminal.sendText(commandLine); return undefined; From 0e5a052b90ecf8496458dd37845512a524bd9702 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Sun, 8 Dec 2024 21:50:09 -0800 Subject: [PATCH 3/9] try to fix test --- src/client/common/terminal/service.ts | 24 +++++++++------- .../common/terminals/service.unit.test.ts | 28 +++++++++++++++++-- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/client/common/terminal/service.ts b/src/client/common/terminal/service.ts index 5be7aed6fadc..eb61a81dd8e6 100644 --- a/src/client/common/terminal/service.ts +++ b/src/client/common/terminal/service.ts @@ -104,16 +104,7 @@ export class TerminalService implements ITerminalService, Disposable { } const config = getConfiguration('python'); const pythonrcSetting = config.get('terminal.shellIntegration.enabled'); - - const pythonPath = this.serviceContainer - .get(IConfigurationService) - .getSettings(this.options?.resource).pythonPath; - const interpreterInfo = - this.options?.interpreter || - (await this.serviceContainer - .get(IInterpreterService) - .getInterpreterDetails(pythonPath)); - const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; + const pythonVersion = await this.getPythonVersion(); const isPython313 = pythonVersion?.startsWith('3.13'); if (isPythonShell && (!pythonrcSetting || isWindows() || isPython313)) { @@ -191,4 +182,17 @@ export class TerminalService implements ITerminalService, Disposable { interpreterType, }); } + + private async getPythonVersion(): Promise { + const pythonPath = this.serviceContainer + .get(IConfigurationService) + .getSettings(this.options?.resource).pythonPath; + const interpreterInfo = + this.options?.interpreter || + (await this.serviceContainer + .get(IInterpreterService) + .getInterpreterDetails(pythonPath)); + const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; + return pythonVersion; + } } diff --git a/src/test/common/terminals/service.unit.test.ts b/src/test/common/terminals/service.unit.test.ts index 147803a72598..d7429c3a950c 100644 --- a/src/test/common/terminals/service.unit.test.ts +++ b/src/test/common/terminals/service.unit.test.ts @@ -19,15 +19,19 @@ import { EXTENSION_ROOT_DIR } from '../../../client/common/constants'; import { IPlatformService } from '../../../client/common/platform/types'; import { TerminalService } from '../../../client/common/terminal/service'; import { ITerminalActivator, ITerminalHelper, TerminalShellType } from '../../../client/common/terminal/types'; -import { IDisposableRegistry } from '../../../client/common/types'; +import { IConfigurationService, IDisposableRegistry } from '../../../client/common/types'; import { IServiceContainer } from '../../../client/ioc/types'; import { ITerminalAutoActivation } from '../../../client/terminals/types'; import { createPythonInterpreter } from '../../utils/interpreters'; import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis'; import * as platform from '../../../client/common/utils/platform'; +import { IInterpreterService } from '../../../client/interpreter/contracts'; +import { PythonEnvironment } from '../../../client/pythonEnvironments/info'; suite('Terminal Service', () => { let service: TerminalService; + let configService: TypeMoq.IMock; + let interpreterService: TypeMoq.IMock; let terminal: TypeMoq.IMock; let terminalManager: TypeMoq.IMock; let terminalHelper: TypeMoq.IMock; @@ -44,8 +48,23 @@ suite('Terminal Service', () => { let pythonConfig: TypeMoq.IMock; let editorConfig: TypeMoq.IMock; let isWindowsStub: sinon.SinonStub; + // let getPythonVersionStub: sinon.SinonStub; setup(() => { + configService = TypeMoq.Mock.ofType(); + configService.setup((c) => c.getSettings()).returns(() => ({ pythonPath: 'pythonPath' } as any)); + + // configService.setup((t) => t.getSettings); + interpreterService = TypeMoq.Mock.ofType(); + // when(interpreterService.getInterpreterDetails(anything())).thenResolve({ + // version: { major: 3 }, + // // eslint-disable-next-line @typescript-eslint/no-explicit-any + // } as any); + + interpreterService + .setup((i) => i.getInterpreterDetails(TypeMoq.It.isAny())) + .returns(() => Promise.resolve(({ envName: 'base' } as unknown) as PythonEnvironment)); + terminal = TypeMoq.Mock.ofType(); terminalShellIntegration = TypeMoq.Mock.ofType(); terminal.setup((t) => t.shellIntegration).returns(() => terminalShellIntegration.object); @@ -95,8 +114,11 @@ suite('Terminal Service', () => { mockServiceContainer.setup((c) => c.get(IWorkspaceService)).returns(() => workspaceService.object); mockServiceContainer.setup((c) => c.get(ITerminalActivator)).returns(() => terminalActivator.object); mockServiceContainer.setup((c) => c.get(ITerminalAutoActivation)).returns(() => terminalAutoActivator.object); + mockServiceContainer.setup((c) => c.get(IConfigurationService)).returns(() => configService.object); + mockServiceContainer.setup((c) => c.get(IInterpreterService)).returns(() => interpreterService.object); getConfigurationStub = sinon.stub(workspaceApis, 'getConfiguration'); isWindowsStub = sinon.stub(platform, 'isWindows'); + pythonConfig = TypeMoq.Mock.ofType(); editorConfig = TypeMoq.Mock.ofType(); getConfigurationStub.callsFake((section: string) => { @@ -234,7 +256,7 @@ suite('Terminal Service', () => { terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.exactly(1)); }); - test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux', async () => { + test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux : !Python3.13', async () => { isWindowsStub.returns(false); pythonConfig .setup((p) => p.get('terminal.shellIntegration.enabled')) @@ -256,6 +278,8 @@ suite('Terminal Service', () => { terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.never()); }); + // Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux : Python3.13 + test('Ensure sendText IS called even when Python shell integration and terminal shell integration are both enabled - Window', async () => { isWindowsStub.returns(true); pythonConfig From 4c5560216d8bbe357e1c29bc2480bc59b81bd736 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Sun, 8 Dec 2024 22:28:42 -0800 Subject: [PATCH 4/9] removed all my changes and tests are still failing? --- src/client/common/terminal/service.ts | 30 +++++++++---------- .../common/terminals/service.unit.test.ts | 28 ++--------------- 2 files changed, 17 insertions(+), 41 deletions(-) diff --git a/src/client/common/terminal/service.ts b/src/client/common/terminal/service.ts index eb61a81dd8e6..315d56138617 100644 --- a/src/client/common/terminal/service.ts +++ b/src/client/common/terminal/service.ts @@ -104,10 +104,10 @@ export class TerminalService implements ITerminalService, Disposable { } const config = getConfiguration('python'); const pythonrcSetting = config.get('terminal.shellIntegration.enabled'); - const pythonVersion = await this.getPythonVersion(); - const isPython313 = pythonVersion?.startsWith('3.13'); + // const pythonVersion = 'await this.getPythonVersion()'; + // const isPython313 = pythonVersion?.startsWith('3.13'); - if (isPythonShell && (!pythonrcSetting || isWindows() || isPython313)) { + if (isPythonShell && (!pythonrcSetting || isWindows())) { // If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL. terminal.sendText(commandLine); return undefined; @@ -183,16 +183,16 @@ export class TerminalService implements ITerminalService, Disposable { }); } - private async getPythonVersion(): Promise { - const pythonPath = this.serviceContainer - .get(IConfigurationService) - .getSettings(this.options?.resource).pythonPath; - const interpreterInfo = - this.options?.interpreter || - (await this.serviceContainer - .get(IInterpreterService) - .getInterpreterDetails(pythonPath)); - const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; - return pythonVersion; - } + // private async getPythonVersion(): Promise { + // const pythonPath = this.serviceContainer + // .get(IConfigurationService) + // .getSettings(this.options?.resource).pythonPath; + // const interpreterInfo = + // this.options?.interpreter || + // (await this.serviceContainer + // .get(IInterpreterService) + // .getInterpreterDetails(pythonPath)); + // const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; + // return pythonVersion; + // } } diff --git a/src/test/common/terminals/service.unit.test.ts b/src/test/common/terminals/service.unit.test.ts index d7429c3a950c..147803a72598 100644 --- a/src/test/common/terminals/service.unit.test.ts +++ b/src/test/common/terminals/service.unit.test.ts @@ -19,19 +19,15 @@ import { EXTENSION_ROOT_DIR } from '../../../client/common/constants'; import { IPlatformService } from '../../../client/common/platform/types'; import { TerminalService } from '../../../client/common/terminal/service'; import { ITerminalActivator, ITerminalHelper, TerminalShellType } from '../../../client/common/terminal/types'; -import { IConfigurationService, IDisposableRegistry } from '../../../client/common/types'; +import { IDisposableRegistry } from '../../../client/common/types'; import { IServiceContainer } from '../../../client/ioc/types'; import { ITerminalAutoActivation } from '../../../client/terminals/types'; import { createPythonInterpreter } from '../../utils/interpreters'; import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis'; import * as platform from '../../../client/common/utils/platform'; -import { IInterpreterService } from '../../../client/interpreter/contracts'; -import { PythonEnvironment } from '../../../client/pythonEnvironments/info'; suite('Terminal Service', () => { let service: TerminalService; - let configService: TypeMoq.IMock; - let interpreterService: TypeMoq.IMock; let terminal: TypeMoq.IMock; let terminalManager: TypeMoq.IMock; let terminalHelper: TypeMoq.IMock; @@ -48,23 +44,8 @@ suite('Terminal Service', () => { let pythonConfig: TypeMoq.IMock; let editorConfig: TypeMoq.IMock; let isWindowsStub: sinon.SinonStub; - // let getPythonVersionStub: sinon.SinonStub; setup(() => { - configService = TypeMoq.Mock.ofType(); - configService.setup((c) => c.getSettings()).returns(() => ({ pythonPath: 'pythonPath' } as any)); - - // configService.setup((t) => t.getSettings); - interpreterService = TypeMoq.Mock.ofType(); - // when(interpreterService.getInterpreterDetails(anything())).thenResolve({ - // version: { major: 3 }, - // // eslint-disable-next-line @typescript-eslint/no-explicit-any - // } as any); - - interpreterService - .setup((i) => i.getInterpreterDetails(TypeMoq.It.isAny())) - .returns(() => Promise.resolve(({ envName: 'base' } as unknown) as PythonEnvironment)); - terminal = TypeMoq.Mock.ofType(); terminalShellIntegration = TypeMoq.Mock.ofType(); terminal.setup((t) => t.shellIntegration).returns(() => terminalShellIntegration.object); @@ -114,11 +95,8 @@ suite('Terminal Service', () => { mockServiceContainer.setup((c) => c.get(IWorkspaceService)).returns(() => workspaceService.object); mockServiceContainer.setup((c) => c.get(ITerminalActivator)).returns(() => terminalActivator.object); mockServiceContainer.setup((c) => c.get(ITerminalAutoActivation)).returns(() => terminalAutoActivator.object); - mockServiceContainer.setup((c) => c.get(IConfigurationService)).returns(() => configService.object); - mockServiceContainer.setup((c) => c.get(IInterpreterService)).returns(() => interpreterService.object); getConfigurationStub = sinon.stub(workspaceApis, 'getConfiguration'); isWindowsStub = sinon.stub(platform, 'isWindows'); - pythonConfig = TypeMoq.Mock.ofType(); editorConfig = TypeMoq.Mock.ofType(); getConfigurationStub.callsFake((section: string) => { @@ -256,7 +234,7 @@ suite('Terminal Service', () => { terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.exactly(1)); }); - test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux : !Python3.13', async () => { + test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux', async () => { isWindowsStub.returns(false); pythonConfig .setup((p) => p.get('terminal.shellIntegration.enabled')) @@ -278,8 +256,6 @@ suite('Terminal Service', () => { terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.never()); }); - // Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux : Python3.13 - test('Ensure sendText IS called even when Python shell integration and terminal shell integration are both enabled - Window', async () => { isWindowsStub.returns(true); pythonConfig From 8e9911063934eb95e1e0c2435602fcc5149ec737 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Sun, 8 Dec 2024 22:41:36 -0800 Subject: [PATCH 5/9] why complain about exact same code that was previously there --- src/client/common/terminal/service.ts | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/client/common/terminal/service.ts b/src/client/common/terminal/service.ts index 315d56138617..d072ceb5e544 100644 --- a/src/client/common/terminal/service.ts +++ b/src/client/common/terminal/service.ts @@ -104,8 +104,8 @@ export class TerminalService implements ITerminalService, Disposable { } const config = getConfiguration('python'); const pythonrcSetting = config.get('terminal.shellIntegration.enabled'); - // const pythonVersion = 'await this.getPythonVersion()'; - // const isPython313 = pythonVersion?.startsWith('3.13'); + const pythonVersion = await this.getPythonVersion(); + const isPython313 = pythonVersion?.startsWith('3.13'); if (isPythonShell && (!pythonrcSetting || isWindows())) { // If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL. @@ -183,16 +183,16 @@ export class TerminalService implements ITerminalService, Disposable { }); } - // private async getPythonVersion(): Promise { - // const pythonPath = this.serviceContainer - // .get(IConfigurationService) - // .getSettings(this.options?.resource).pythonPath; - // const interpreterInfo = - // this.options?.interpreter || - // (await this.serviceContainer - // .get(IInterpreterService) - // .getInterpreterDetails(pythonPath)); - // const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; - // return pythonVersion; - // } + private async getPythonVersion(): Promise { + const pythonPath = this.serviceContainer + .get(IConfigurationService) + .getSettings(this.options?.resource).pythonPath; + const interpreterInfo = + this.options?.interpreter || + (await this.serviceContainer + .get(IInterpreterService) + .getInterpreterDetails(pythonPath)); + const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; + return pythonVersion; + } } From 9bc622fb950d92de765f9e3adebe7ca098c69c38 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Sun, 8 Dec 2024 22:43:34 -0800 Subject: [PATCH 6/9] NO CHANGE --- src/client/common/terminal/service.ts | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/client/common/terminal/service.ts b/src/client/common/terminal/service.ts index d072ceb5e544..0f78528dbd11 100644 --- a/src/client/common/terminal/service.ts +++ b/src/client/common/terminal/service.ts @@ -104,8 +104,8 @@ export class TerminalService implements ITerminalService, Disposable { } const config = getConfiguration('python'); const pythonrcSetting = config.get('terminal.shellIntegration.enabled'); - const pythonVersion = await this.getPythonVersion(); - const isPython313 = pythonVersion?.startsWith('3.13'); + // const pythonVersion = await this.getPythonVersion(); + // const isPython313 = pythonVersion?.startsWith('3.13'); if (isPythonShell && (!pythonrcSetting || isWindows())) { // If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL. @@ -183,16 +183,16 @@ export class TerminalService implements ITerminalService, Disposable { }); } - private async getPythonVersion(): Promise { - const pythonPath = this.serviceContainer - .get(IConfigurationService) - .getSettings(this.options?.resource).pythonPath; - const interpreterInfo = - this.options?.interpreter || - (await this.serviceContainer - .get(IInterpreterService) - .getInterpreterDetails(pythonPath)); - const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; - return pythonVersion; - } + // private async getPythonVersion(): Promise { + // const pythonPath = this.serviceContainer + // .get(IConfigurationService) + // .getSettings(this.options?.resource).pythonPath; + // const interpreterInfo = + // this.options?.interpreter || + // (await this.serviceContainer + // .get(IInterpreterService) + // .getInterpreterDetails(pythonPath)); + // const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; + // return pythonVersion; + // } } From ff67dce71918e599a94ce64df4d308a0ab34a6be Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Sun, 8 Dec 2024 23:01:36 -0800 Subject: [PATCH 7/9] lets go --- src/client/common/terminal/service.ts | 12 +++++++++++- src/test/common/terminals/service.unit.test.ts | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/client/common/terminal/service.ts b/src/client/common/terminal/service.ts index 0f78528dbd11..b6158c7a7592 100644 --- a/src/client/common/terminal/service.ts +++ b/src/client/common/terminal/service.ts @@ -22,6 +22,7 @@ import { import { traceVerbose } from '../../logging'; import { getConfiguration } from '../vscodeApis/workspaceApis'; import { isWindows } from '../utils/platform'; +import { getActiveInterpreter } from '../../repl/replUtils'; @injectable() export class TerminalService implements ITerminalService, Disposable { @@ -107,7 +108,16 @@ export class TerminalService implements ITerminalService, Disposable { // const pythonVersion = await this.getPythonVersion(); // const isPython313 = pythonVersion?.startsWith('3.13'); - if (isPythonShell && (!pythonrcSetting || isWindows())) { + let isPython313 = false; + if (this.options && this.options.resource) { + const pythonVersion = await getActiveInterpreter( + this.options.resource, + this.serviceContainer.get(IInterpreterService), + ); + pythonVersion?.sysVersion?.startsWith('3.13'); + } + + if (isPythonShell && (!pythonrcSetting || isWindows() || isPython313)) { // If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL. terminal.sendText(commandLine); return undefined; diff --git a/src/test/common/terminals/service.unit.test.ts b/src/test/common/terminals/service.unit.test.ts index 147803a72598..4b21ed8f262d 100644 --- a/src/test/common/terminals/service.unit.test.ts +++ b/src/test/common/terminals/service.unit.test.ts @@ -25,6 +25,8 @@ import { ITerminalAutoActivation } from '../../../client/terminals/types'; import { createPythonInterpreter } from '../../utils/interpreters'; import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis'; import * as platform from '../../../client/common/utils/platform'; +import { IInterpreterService } from '../../../client/interpreter/contracts'; +import { PythonEnvironment } from '../../../client/pythonEnvironments/info'; suite('Terminal Service', () => { let service: TerminalService; @@ -44,6 +46,7 @@ suite('Terminal Service', () => { let pythonConfig: TypeMoq.IMock; let editorConfig: TypeMoq.IMock; let isWindowsStub: sinon.SinonStub; + let interpreterService: TypeMoq.IMock; setup(() => { terminal = TypeMoq.Mock.ofType(); @@ -87,6 +90,10 @@ suite('Terminal Service', () => { disposables = []; mockServiceContainer = TypeMoq.Mock.ofType(); + interpreterService = TypeMoq.Mock.ofType(); + interpreterService + .setup((i) => i.getActiveInterpreter(TypeMoq.It.isAny())) + .returns(() => Promise.resolve(({ path: 'ps' } as unknown) as PythonEnvironment)); mockServiceContainer.setup((c) => c.get(ITerminalManager)).returns(() => terminalManager.object); mockServiceContainer.setup((c) => c.get(ITerminalHelper)).returns(() => terminalHelper.object); @@ -95,6 +102,8 @@ suite('Terminal Service', () => { mockServiceContainer.setup((c) => c.get(IWorkspaceService)).returns(() => workspaceService.object); mockServiceContainer.setup((c) => c.get(ITerminalActivator)).returns(() => terminalActivator.object); mockServiceContainer.setup((c) => c.get(ITerminalAutoActivation)).returns(() => terminalAutoActivator.object); + mockServiceContainer.setup((c) => c.get(IInterpreterService)).returns(() => interpreterService.object); + getConfigurationStub = sinon.stub(workspaceApis, 'getConfiguration'); isWindowsStub = sinon.stub(platform, 'isWindows'); pythonConfig = TypeMoq.Mock.ofType(); From 8df8b127122cebee83f37c0be86c8374ab4a4033 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Sun, 8 Dec 2024 23:03:16 -0800 Subject: [PATCH 8/9] remove unused --- src/client/common/terminal/service.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/client/common/terminal/service.ts b/src/client/common/terminal/service.ts index b6158c7a7592..64892045b391 100644 --- a/src/client/common/terminal/service.ts +++ b/src/client/common/terminal/service.ts @@ -105,8 +105,6 @@ export class TerminalService implements ITerminalService, Disposable { } const config = getConfiguration('python'); const pythonrcSetting = config.get('terminal.shellIntegration.enabled'); - // const pythonVersion = await this.getPythonVersion(); - // const isPython313 = pythonVersion?.startsWith('3.13'); let isPython313 = false; if (this.options && this.options.resource) { @@ -192,17 +190,4 @@ export class TerminalService implements ITerminalService, Disposable { interpreterType, }); } - - // private async getPythonVersion(): Promise { - // const pythonPath = this.serviceContainer - // .get(IConfigurationService) - // .getSettings(this.options?.resource).pythonPath; - // const interpreterInfo = - // this.options?.interpreter || - // (await this.serviceContainer - // .get(IInterpreterService) - // .getInterpreterDetails(pythonPath)); - // const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined; - // return pythonVersion; - // } } From d3b8edcaad4e4752ff1f5e11bd0a470c8e93170a Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Sun, 8 Dec 2024 23:11:28 -0800 Subject: [PATCH 9/9] update to be more specific --- src/test/common/terminals/service.unit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/common/terminals/service.unit.test.ts b/src/test/common/terminals/service.unit.test.ts index 4b21ed8f262d..d46d17a01ded 100644 --- a/src/test/common/terminals/service.unit.test.ts +++ b/src/test/common/terminals/service.unit.test.ts @@ -243,7 +243,7 @@ suite('Terminal Service', () => { terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.exactly(1)); }); - test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux', async () => { + test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux - !Python3.13', async () => { isWindowsStub.returns(false); pythonConfig .setup((p) => p.get('terminal.shellIntegration.enabled'))