Skip to content

Commit 0317c6b

Browse files
authored
PYTHONSTARTUP should be injected regardless of terminalEnv experiment (#25037)
Resolve: #25013 Python shell integration env var injection via env var collection was getting cleared undesirable, when user had opted out of terminal env var experiment. We want to inject PYTHONSTARTUP regardless of the experiment, depending on user setting.
1 parent b44b4d4 commit 0317c6b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/client/terminals/envCollectionActivation/service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
} from '../types';
4545
import { ProgressService } from '../../common/application/progressService';
4646
import { useEnvExtension } from '../../envExt/api.internal';
47+
import { registerPythonStartup } from '../pythonStartup';
4748

4849
@injectable()
4950
export class TerminalEnvVarCollectionService implements IExtensionActivationService, ITerminalEnvVarCollectionService {
@@ -109,6 +110,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
109110
);
110111
this.registeredOnce = true;
111112
}
113+
await registerPythonStartup(this.context);
112114
return;
113115
}
114116
if (!this.registeredOnce) {

src/test/interpreters/activation/terminalEnvVarCollectionService.unit.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
import * as sinon from 'sinon';
77
import { assert, expect } from 'chai';
88
import { mock, instance, when, anything, verify, reset } from 'ts-mockito';
9+
import * as TypeMoq from 'typemoq';
910
import {
1011
EnvironmentVariableCollection,
1112
EnvironmentVariableMutatorOptions,
1213
GlobalEnvironmentVariableCollection,
1314
ProgressLocation,
1415
Uri,
16+
WorkspaceConfiguration,
1517
WorkspaceFolder,
1618
} from 'vscode';
1719
import {
@@ -55,6 +57,7 @@ suite('Terminal Environment Variable Collection Service', () => {
5557
let terminalEnvVarCollectionService: TerminalEnvVarCollectionService;
5658
let terminalDeactivateService: ITerminalDeactivateService;
5759
let useEnvExtensionStub: sinon.SinonStub;
60+
let pythonConfig: TypeMoq.IMock<WorkspaceConfiguration>;
5861
const progressOptions = {
5962
location: ProgressLocation.Window,
6063
title: Interpreters.activatingTerminals,
@@ -122,6 +125,8 @@ suite('Terminal Environment Variable Collection Service', () => {
122125
instance(shellIntegrationService),
123126
instance(envVarProvider),
124127
);
128+
pythonConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
129+
pythonConfig.setup((p) => p.get('terminal.shellIntegration.enabled')).returns(() => false);
125130
});
126131

127132
teardown(() => {

0 commit comments

Comments
 (0)