Skip to content

Commit 4c55602

Browse files
committed
removed all my changes and tests are still failing?
1 parent 0e5a052 commit 4c55602

File tree

2 files changed

+17
-41
lines changed

2 files changed

+17
-41
lines changed

src/client/common/terminal/service.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ export class TerminalService implements ITerminalService, Disposable {
104104
}
105105
const config = getConfiguration('python');
106106
const pythonrcSetting = config.get<boolean>('terminal.shellIntegration.enabled');
107-
const pythonVersion = await this.getPythonVersion();
108-
const isPython313 = pythonVersion?.startsWith('3.13');
107+
// const pythonVersion = 'await this.getPythonVersion()';
108+
// const isPython313 = pythonVersion?.startsWith('3.13');
109109

110-
if (isPythonShell && (!pythonrcSetting || isWindows() || isPython313)) {
110+
if (isPythonShell && (!pythonrcSetting || isWindows())) {
111111
// If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL.
112112
terminal.sendText(commandLine);
113113
return undefined;
@@ -183,16 +183,16 @@ export class TerminalService implements ITerminalService, Disposable {
183183
});
184184
}
185185

186-
private async getPythonVersion(): Promise<string | undefined> {
187-
const pythonPath = this.serviceContainer
188-
.get<IConfigurationService>(IConfigurationService)
189-
.getSettings(this.options?.resource).pythonPath;
190-
const interpreterInfo =
191-
this.options?.interpreter ||
192-
(await this.serviceContainer
193-
.get<IInterpreterService>(IInterpreterService)
194-
.getInterpreterDetails(pythonPath));
195-
const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined;
196-
return pythonVersion;
197-
}
186+
// private async getPythonVersion(): Promise<string | undefined> {
187+
// const pythonPath = this.serviceContainer
188+
// .get<IConfigurationService>(IConfigurationService)
189+
// .getSettings(this.options?.resource).pythonPath;
190+
// const interpreterInfo =
191+
// this.options?.interpreter ||
192+
// (await this.serviceContainer
193+
// .get<IInterpreterService>(IInterpreterService)
194+
// .getInterpreterDetails(pythonPath));
195+
// const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined;
196+
// return pythonVersion;
197+
// }
198198
}

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

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,15 @@ import { EXTENSION_ROOT_DIR } from '../../../client/common/constants';
1919
import { IPlatformService } from '../../../client/common/platform/types';
2020
import { TerminalService } from '../../../client/common/terminal/service';
2121
import { ITerminalActivator, ITerminalHelper, TerminalShellType } from '../../../client/common/terminal/types';
22-
import { IConfigurationService, IDisposableRegistry } from '../../../client/common/types';
22+
import { IDisposableRegistry } from '../../../client/common/types';
2323
import { IServiceContainer } from '../../../client/ioc/types';
2424
import { ITerminalAutoActivation } from '../../../client/terminals/types';
2525
import { createPythonInterpreter } from '../../utils/interpreters';
2626
import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis';
2727
import * as platform from '../../../client/common/utils/platform';
28-
import { IInterpreterService } from '../../../client/interpreter/contracts';
29-
import { PythonEnvironment } from '../../../client/pythonEnvironments/info';
3028

3129
suite('Terminal Service', () => {
3230
let service: TerminalService;
33-
let configService: TypeMoq.IMock<IConfigurationService>;
34-
let interpreterService: TypeMoq.IMock<IInterpreterService>;
3531
let terminal: TypeMoq.IMock<VSCodeTerminal>;
3632
let terminalManager: TypeMoq.IMock<ITerminalManager>;
3733
let terminalHelper: TypeMoq.IMock<ITerminalHelper>;
@@ -48,23 +44,8 @@ suite('Terminal Service', () => {
4844
let pythonConfig: TypeMoq.IMock<WorkspaceConfiguration>;
4945
let editorConfig: TypeMoq.IMock<WorkspaceConfiguration>;
5046
let isWindowsStub: sinon.SinonStub;
51-
// let getPythonVersionStub: sinon.SinonStub;
5247

5348
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-
6849
terminal = TypeMoq.Mock.ofType<VSCodeTerminal>();
6950
terminalShellIntegration = TypeMoq.Mock.ofType<TerminalShellIntegration>();
7051
terminal.setup((t) => t.shellIntegration).returns(() => terminalShellIntegration.object);
@@ -114,11 +95,8 @@ suite('Terminal Service', () => {
11495
mockServiceContainer.setup((c) => c.get(IWorkspaceService)).returns(() => workspaceService.object);
11596
mockServiceContainer.setup((c) => c.get(ITerminalActivator)).returns(() => terminalActivator.object);
11697
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);
11998
getConfigurationStub = sinon.stub(workspaceApis, 'getConfiguration');
12099
isWindowsStub = sinon.stub(platform, 'isWindows');
121-
122100
pythonConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
123101
editorConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
124102
getConfigurationStub.callsFake((section: string) => {
@@ -256,7 +234,7 @@ suite('Terminal Service', () => {
256234
terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.exactly(1));
257235
});
258236

259-
test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux : !Python3.13', async () => {
237+
test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux', async () => {
260238
isWindowsStub.returns(false);
261239
pythonConfig
262240
.setup((p) => p.get('terminal.shellIntegration.enabled'))
@@ -278,8 +256,6 @@ suite('Terminal Service', () => {
278256
terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.never());
279257
});
280258

281-
// Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux : Python3.13
282-
283259
test('Ensure sendText IS called even when Python shell integration and terminal shell integration are both enabled - Window', async () => {
284260
isWindowsStub.returns(true);
285261
pythonConfig

0 commit comments

Comments
 (0)