Skip to content

Commit 3f43131

Browse files
karthiknadigeleanorjboyd
authored andcommitted
Remove the pip trigger to create environment (microsoft#23728)
1 parent cb39111 commit 3f43131

File tree

3 files changed

+2
-42
lines changed

3 files changed

+2
-42
lines changed

src/client/common/experiments/groups.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,3 @@ export enum EnableTestAdapterRewrite {
2424
export enum RecommendTensobardExtension {
2525
experiment = 'pythonRecommendTensorboardExt',
2626
}
27-
28-
// Experiment to enable triggering venv creation when users install with `pip`
29-
// in a global environment
30-
export enum CreateEnvOnPipInstallTrigger {
31-
experiment = 'pythonCreateEnvOnPipInstall',
32-
}

src/client/pythonEnvironments/creation/globalPipInTerminalTrigger.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { Disposable, TerminalShellExecutionStartEvent } from 'vscode';
2-
import { CreateEnvOnPipInstallTrigger } from '../../common/experiments/groups';
3-
import { inExperiment } from '../common/externalDependencies';
42
import {
53
disableCreateEnvironmentTrigger,
64
isGlobalPythonSelected,
@@ -27,7 +25,7 @@ function checkCommand(command: string): boolean {
2725
}
2826

2927
export function registerTriggerForPipInTerminal(disposables: Disposable[]): void {
30-
if (!shouldPromptToCreateEnv() || !inExperiment(CreateEnvOnPipInstallTrigger.experiment)) {
28+
if (!shouldPromptToCreateEnv()) {
3129
return;
3230
}
3331

src/test/pythonEnvironments/creation/globalPipInTerminalTrigger.unit.test.ts

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ import * as triggerUtils from '../../../client/pythonEnvironments/creation/commo
1717
import * as windowApis from '../../../client/common/vscodeApis/windowApis';
1818
import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis';
1919
import * as commandApis from '../../../client/common/vscodeApis/commandApis';
20-
import * as extDepApi from '../../../client/pythonEnvironments/common/externalDependencies';
2120
import { registerTriggerForPipInTerminal } from '../../../client/pythonEnvironments/creation/globalPipInTerminalTrigger';
2221
import { EXTENSION_ROOT_DIR_FOR_TESTS } from '../../constants';
2322
import { Common, CreateEnv } from '../../../client/common/utils/localize';
2423

2524
suite('Global Pip in Terminal Trigger', () => {
2625
let shouldPromptToCreateEnvStub: sinon.SinonStub;
27-
let inExperimentStub: sinon.SinonStub;
2826
let getWorkspaceFoldersStub: sinon.SinonStub;
2927
let getWorkspaceFolderStub: sinon.SinonStub;
3028
let isGlobalPythonSelectedStub: sinon.SinonStub;
@@ -48,7 +46,6 @@ suite('Global Pip in Terminal Trigger', () => {
4846

4947
setup(() => {
5048
shouldPromptToCreateEnvStub = sinon.stub(triggerUtils, 'shouldPromptToCreateEnv');
51-
inExperimentStub = sinon.stub(extDepApi, 'inExperiment');
5249

5350
getWorkspaceFoldersStub = sinon.stub(workspaceApis, 'getWorkspaceFolders');
5451
getWorkspaceFoldersStub.returns([workspace1]);
@@ -88,7 +85,6 @@ suite('Global Pip in Terminal Trigger', () => {
8885

8986
test('Should not prompt to create environment if setting is off', async () => {
9087
shouldPromptToCreateEnvStub.returns(false);
91-
inExperimentStub.returns(true);
9288

9389
const disposables: Disposable[] = [];
9490
registerTriggerForPipInTerminal(disposables);
@@ -97,35 +93,20 @@ suite('Global Pip in Terminal Trigger', () => {
9793
sinon.assert.calledOnce(shouldPromptToCreateEnvStub);
9894
});
9995

100-
test('Should not prompt to create environment if experiment is off', async () => {
101-
shouldPromptToCreateEnvStub.returns(true);
102-
inExperimentStub.returns(false);
103-
104-
const disposables: Disposable[] = [];
105-
registerTriggerForPipInTerminal(disposables);
106-
107-
assert.strictEqual(disposables.length, 0);
108-
sinon.assert.calledOnce(shouldPromptToCreateEnvStub);
109-
sinon.assert.calledOnce(inExperimentStub);
110-
});
111-
11296
test('Should not prompt to create environment if no workspace folders', async () => {
11397
shouldPromptToCreateEnvStub.returns(true);
114-
inExperimentStub.returns(true);
11598
getWorkspaceFoldersStub.returns([]);
11699

117100
const disposables: Disposable[] = [];
118101
registerTriggerForPipInTerminal(disposables);
119102

120103
assert.strictEqual(disposables.length, 0);
121104
sinon.assert.calledOnce(shouldPromptToCreateEnvStub);
122-
sinon.assert.calledOnce(inExperimentStub);
123105
sinon.assert.calledOnce(getWorkspaceFoldersStub);
124106
});
125107

126108
test('Should not prompt to create environment if workspace folder is not found', async () => {
127109
shouldPromptToCreateEnvStub.returns(true);
128-
inExperimentStub.returns(true);
129110
getWorkspaceFolderStub.returns(undefined);
130111

131112
const disposables: Disposable[] = [];
@@ -136,16 +117,13 @@ suite('Global Pip in Terminal Trigger', () => {
136117

137118
assert.strictEqual(disposables.length, 1);
138119
sinon.assert.calledOnce(shouldPromptToCreateEnvStub);
139-
sinon.assert.calledOnce(inExperimentStub);
140120
sinon.assert.calledOnce(getWorkspaceFolderStub);
141-
142121
sinon.assert.notCalled(isGlobalPythonSelectedStub);
143122
sinon.assert.notCalled(showWarningMessageStub);
144123
});
145124

146125
test('Should not prompt to create environment if global python is not selected', async () => {
147126
shouldPromptToCreateEnvStub.returns(true);
148-
inExperimentStub.returns(true);
149127
isGlobalPythonSelectedStub.returns(false);
150128

151129
const disposables: Disposable[] = [];
@@ -155,7 +133,6 @@ suite('Global Pip in Terminal Trigger', () => {
155133

156134
assert.strictEqual(disposables.length, 1);
157135
sinon.assert.calledOnce(shouldPromptToCreateEnvStub);
158-
sinon.assert.calledOnce(inExperimentStub);
159136
sinon.assert.calledOnce(getWorkspaceFolderStub);
160137
sinon.assert.calledOnce(isGlobalPythonSelectedStub);
161138

@@ -164,7 +141,6 @@ suite('Global Pip in Terminal Trigger', () => {
164141

165142
test('Should not prompt to create environment if command is not trusted', async () => {
166143
shouldPromptToCreateEnvStub.returns(true);
167-
inExperimentStub.returns(true);
168144
isGlobalPythonSelectedStub.returns(true);
169145

170146
const disposables: Disposable[] = [];
@@ -189,7 +165,6 @@ suite('Global Pip in Terminal Trigger', () => {
189165

190166
assert.strictEqual(disposables.length, 1);
191167
sinon.assert.calledOnce(shouldPromptToCreateEnvStub);
192-
sinon.assert.calledOnce(inExperimentStub);
193168
sinon.assert.calledOnce(getWorkspaceFolderStub);
194169
sinon.assert.calledOnce(isGlobalPythonSelectedStub);
195170

@@ -198,7 +173,6 @@ suite('Global Pip in Terminal Trigger', () => {
198173

199174
test('Should not prompt to create environment if command does not start with pip install', async () => {
200175
shouldPromptToCreateEnvStub.returns(true);
201-
inExperimentStub.returns(true);
202176
isGlobalPythonSelectedStub.returns(true);
203177

204178
const disposables: Disposable[] = [];
@@ -223,7 +197,6 @@ suite('Global Pip in Terminal Trigger', () => {
223197

224198
assert.strictEqual(disposables.length, 1);
225199
sinon.assert.calledOnce(shouldPromptToCreateEnvStub);
226-
sinon.assert.calledOnce(inExperimentStub);
227200
sinon.assert.calledOnce(getWorkspaceFolderStub);
228201
sinon.assert.calledOnce(isGlobalPythonSelectedStub);
229202

@@ -233,7 +206,6 @@ suite('Global Pip in Terminal Trigger', () => {
233206
['pip install', 'pip3 install', 'python -m pip install', 'python3 -m pip install'].forEach((command) => {
234207
test(`Should prompt to create environment if all conditions are met: ${command}`, async () => {
235208
shouldPromptToCreateEnvStub.returns(true);
236-
inExperimentStub.returns(true);
237209
isGlobalPythonSelectedStub.returns(true);
238210
showWarningMessageStub.resolves(CreateEnv.Trigger.createEnvironment);
239211

@@ -259,11 +231,9 @@ suite('Global Pip in Terminal Trigger', () => {
259231

260232
assert.strictEqual(disposables.length, 1);
261233
sinon.assert.calledOnce(shouldPromptToCreateEnvStub);
262-
sinon.assert.calledOnce(inExperimentStub);
263234
sinon.assert.calledOnce(getWorkspaceFolderStub);
264235
sinon.assert.calledOnce(isGlobalPythonSelectedStub);
265236
sinon.assert.calledOnce(showWarningMessageStub);
266-
267237
sinon.assert.calledOnce(executeCommandStub);
268238
sinon.assert.notCalled(disableCreateEnvironmentTriggerStub);
269239

@@ -273,7 +243,7 @@ suite('Global Pip in Terminal Trigger', () => {
273243

274244
test("Should disable create environment trigger if user selects don't show again", async () => {
275245
shouldPromptToCreateEnvStub.returns(true);
276-
inExperimentStub.returns(true);
246+
277247
isGlobalPythonSelectedStub.returns(true);
278248
showWarningMessageStub.resolves(Common.doNotShowAgain);
279249

@@ -299,11 +269,9 @@ suite('Global Pip in Terminal Trigger', () => {
299269

300270
assert.strictEqual(disposables.length, 1);
301271
sinon.assert.calledOnce(shouldPromptToCreateEnvStub);
302-
sinon.assert.calledOnce(inExperimentStub);
303272
sinon.assert.calledOnce(getWorkspaceFolderStub);
304273
sinon.assert.calledOnce(isGlobalPythonSelectedStub);
305274
sinon.assert.calledOnce(showWarningMessageStub);
306-
307275
sinon.assert.notCalled(executeCommandStub);
308276
sinon.assert.calledOnce(disableCreateEnvironmentTriggerStub);
309277
});

0 commit comments

Comments
 (0)