@@ -19,15 +19,19 @@ import { EXTENSION_ROOT_DIR } from '../../../client/common/constants';
1919import { IPlatformService } from '../../../client/common/platform/types' ;
2020import { TerminalService } from '../../../client/common/terminal/service' ;
2121import { ITerminalActivator , ITerminalHelper , TerminalShellType } from '../../../client/common/terminal/types' ;
22- import { IDisposableRegistry } from '../../../client/common/types' ;
22+ import { IConfigurationService , IDisposableRegistry } from '../../../client/common/types' ;
2323import { IServiceContainer } from '../../../client/ioc/types' ;
2424import { ITerminalAutoActivation } from '../../../client/terminals/types' ;
2525import { createPythonInterpreter } from '../../utils/interpreters' ;
2626import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis' ;
2727import * as platform from '../../../client/common/utils/platform' ;
28+ import { IInterpreterService } from '../../../client/interpreter/contracts' ;
29+ import { PythonEnvironment } from '../../../client/pythonEnvironments/info' ;
2830
2931suite ( 'Terminal Service' , ( ) => {
3032 let service : TerminalService ;
33+ let configService : TypeMoq . IMock < IConfigurationService > ;
34+ let interpreterService : TypeMoq . IMock < IInterpreterService > ;
3135 let terminal : TypeMoq . IMock < VSCodeTerminal > ;
3236 let terminalManager : TypeMoq . IMock < ITerminalManager > ;
3337 let terminalHelper : TypeMoq . IMock < ITerminalHelper > ;
@@ -44,8 +48,23 @@ suite('Terminal Service', () => {
4448 let pythonConfig : TypeMoq . IMock < WorkspaceConfiguration > ;
4549 let editorConfig : TypeMoq . IMock < WorkspaceConfiguration > ;
4650 let isWindowsStub : sinon . SinonStub ;
51+ // let getPythonVersionStub: sinon.SinonStub;
4752
4853 setup ( ( ) => {
54+ configService = TypeMoq . Mock . ofType < IConfigurationService > ( ) ;
55+ configService . setup ( ( c ) => c . getSettings ( ) ) . returns ( ( ) => ( { pythonPath : 'pythonPath' } as any ) ) ;
56+
57+ // configService.setup((t) => t.getSettings);
58+ interpreterService = TypeMoq . Mock . ofType < IInterpreterService > ( ) ;
59+ // when(interpreterService.getInterpreterDetails(anything())).thenResolve({
60+ // version: { major: 3 },
61+ // // eslint-disable-next-line @typescript-eslint/no-explicit-any
62+ // } as any);
63+
64+ interpreterService
65+ . setup ( ( i ) => i . getInterpreterDetails ( TypeMoq . It . isAny ( ) ) )
66+ . returns ( ( ) => Promise . resolve ( ( { envName : 'base' } as unknown ) as PythonEnvironment ) ) ;
67+
4968 terminal = TypeMoq . Mock . ofType < VSCodeTerminal > ( ) ;
5069 terminalShellIntegration = TypeMoq . Mock . ofType < TerminalShellIntegration > ( ) ;
5170 terminal . setup ( ( t ) => t . shellIntegration ) . returns ( ( ) => terminalShellIntegration . object ) ;
@@ -95,8 +114,11 @@ suite('Terminal Service', () => {
95114 mockServiceContainer . setup ( ( c ) => c . get ( IWorkspaceService ) ) . returns ( ( ) => workspaceService . object ) ;
96115 mockServiceContainer . setup ( ( c ) => c . get ( ITerminalActivator ) ) . returns ( ( ) => terminalActivator . object ) ;
97116 mockServiceContainer . setup ( ( c ) => c . get ( ITerminalAutoActivation ) ) . returns ( ( ) => terminalAutoActivator . object ) ;
117+ mockServiceContainer . setup ( ( c ) => c . get ( IConfigurationService ) ) . returns ( ( ) => configService . object ) ;
118+ mockServiceContainer . setup ( ( c ) => c . get ( IInterpreterService ) ) . returns ( ( ) => interpreterService . object ) ;
98119 getConfigurationStub = sinon . stub ( workspaceApis , 'getConfiguration' ) ;
99120 isWindowsStub = sinon . stub ( platform , 'isWindows' ) ;
121+
100122 pythonConfig = TypeMoq . Mock . ofType < WorkspaceConfiguration > ( ) ;
101123 editorConfig = TypeMoq . Mock . ofType < WorkspaceConfiguration > ( ) ;
102124 getConfigurationStub . callsFake ( ( section : string ) => {
@@ -234,7 +256,7 @@ suite('Terminal Service', () => {
234256 terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
235257 } ) ;
236258
237- test ( 'Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux' , async ( ) => {
259+ test ( 'Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux : !Python3.13 ' , async ( ) => {
238260 isWindowsStub . returns ( false ) ;
239261 pythonConfig
240262 . setup ( ( p ) => p . get ( 'terminal.shellIntegration.enabled' ) )
@@ -256,6 +278,8 @@ suite('Terminal Service', () => {
256278 terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . never ( ) ) ;
257279 } ) ;
258280
281+ // Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux : Python3.13
282+
259283 test ( 'Ensure sendText IS called even when Python shell integration and terminal shell integration are both enabled - Window' , async ( ) => {
260284 isWindowsStub . returns ( true ) ;
261285 pythonConfig
0 commit comments