@@ -17,14 +17,12 @@ import * as triggerUtils from '../../../client/pythonEnvironments/creation/commo
17
17
import * as windowApis from '../../../client/common/vscodeApis/windowApis' ;
18
18
import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis' ;
19
19
import * as commandApis from '../../../client/common/vscodeApis/commandApis' ;
20
- import * as extDepApi from '../../../client/pythonEnvironments/common/externalDependencies' ;
21
20
import { registerTriggerForPipInTerminal } from '../../../client/pythonEnvironments/creation/globalPipInTerminalTrigger' ;
22
21
import { EXTENSION_ROOT_DIR_FOR_TESTS } from '../../constants' ;
23
22
import { Common , CreateEnv } from '../../../client/common/utils/localize' ;
24
23
25
24
suite ( 'Global Pip in Terminal Trigger' , ( ) => {
26
25
let shouldPromptToCreateEnvStub : sinon . SinonStub ;
27
- let inExperimentStub : sinon . SinonStub ;
28
26
let getWorkspaceFoldersStub : sinon . SinonStub ;
29
27
let getWorkspaceFolderStub : sinon . SinonStub ;
30
28
let isGlobalPythonSelectedStub : sinon . SinonStub ;
@@ -48,7 +46,6 @@ suite('Global Pip in Terminal Trigger', () => {
48
46
49
47
setup ( ( ) => {
50
48
shouldPromptToCreateEnvStub = sinon . stub ( triggerUtils , 'shouldPromptToCreateEnv' ) ;
51
- inExperimentStub = sinon . stub ( extDepApi , 'inExperiment' ) ;
52
49
53
50
getWorkspaceFoldersStub = sinon . stub ( workspaceApis , 'getWorkspaceFolders' ) ;
54
51
getWorkspaceFoldersStub . returns ( [ workspace1 ] ) ;
@@ -88,7 +85,6 @@ suite('Global Pip in Terminal Trigger', () => {
88
85
89
86
test ( 'Should not prompt to create environment if setting is off' , async ( ) => {
90
87
shouldPromptToCreateEnvStub . returns ( false ) ;
91
- inExperimentStub . returns ( true ) ;
92
88
93
89
const disposables : Disposable [ ] = [ ] ;
94
90
registerTriggerForPipInTerminal ( disposables ) ;
@@ -97,35 +93,20 @@ suite('Global Pip in Terminal Trigger', () => {
97
93
sinon . assert . calledOnce ( shouldPromptToCreateEnvStub ) ;
98
94
} ) ;
99
95
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
-
112
96
test ( 'Should not prompt to create environment if no workspace folders' , async ( ) => {
113
97
shouldPromptToCreateEnvStub . returns ( true ) ;
114
- inExperimentStub . returns ( true ) ;
115
98
getWorkspaceFoldersStub . returns ( [ ] ) ;
116
99
117
100
const disposables : Disposable [ ] = [ ] ;
118
101
registerTriggerForPipInTerminal ( disposables ) ;
119
102
120
103
assert . strictEqual ( disposables . length , 0 ) ;
121
104
sinon . assert . calledOnce ( shouldPromptToCreateEnvStub ) ;
122
- sinon . assert . calledOnce ( inExperimentStub ) ;
123
105
sinon . assert . calledOnce ( getWorkspaceFoldersStub ) ;
124
106
} ) ;
125
107
126
108
test ( 'Should not prompt to create environment if workspace folder is not found' , async ( ) => {
127
109
shouldPromptToCreateEnvStub . returns ( true ) ;
128
- inExperimentStub . returns ( true ) ;
129
110
getWorkspaceFolderStub . returns ( undefined ) ;
130
111
131
112
const disposables : Disposable [ ] = [ ] ;
@@ -136,16 +117,13 @@ suite('Global Pip in Terminal Trigger', () => {
136
117
137
118
assert . strictEqual ( disposables . length , 1 ) ;
138
119
sinon . assert . calledOnce ( shouldPromptToCreateEnvStub ) ;
139
- sinon . assert . calledOnce ( inExperimentStub ) ;
140
120
sinon . assert . calledOnce ( getWorkspaceFolderStub ) ;
141
-
142
121
sinon . assert . notCalled ( isGlobalPythonSelectedStub ) ;
143
122
sinon . assert . notCalled ( showWarningMessageStub ) ;
144
123
} ) ;
145
124
146
125
test ( 'Should not prompt to create environment if global python is not selected' , async ( ) => {
147
126
shouldPromptToCreateEnvStub . returns ( true ) ;
148
- inExperimentStub . returns ( true ) ;
149
127
isGlobalPythonSelectedStub . returns ( false ) ;
150
128
151
129
const disposables : Disposable [ ] = [ ] ;
@@ -155,7 +133,6 @@ suite('Global Pip in Terminal Trigger', () => {
155
133
156
134
assert . strictEqual ( disposables . length , 1 ) ;
157
135
sinon . assert . calledOnce ( shouldPromptToCreateEnvStub ) ;
158
- sinon . assert . calledOnce ( inExperimentStub ) ;
159
136
sinon . assert . calledOnce ( getWorkspaceFolderStub ) ;
160
137
sinon . assert . calledOnce ( isGlobalPythonSelectedStub ) ;
161
138
@@ -164,7 +141,6 @@ suite('Global Pip in Terminal Trigger', () => {
164
141
165
142
test ( 'Should not prompt to create environment if command is not trusted' , async ( ) => {
166
143
shouldPromptToCreateEnvStub . returns ( true ) ;
167
- inExperimentStub . returns ( true ) ;
168
144
isGlobalPythonSelectedStub . returns ( true ) ;
169
145
170
146
const disposables : Disposable [ ] = [ ] ;
@@ -189,7 +165,6 @@ suite('Global Pip in Terminal Trigger', () => {
189
165
190
166
assert . strictEqual ( disposables . length , 1 ) ;
191
167
sinon . assert . calledOnce ( shouldPromptToCreateEnvStub ) ;
192
- sinon . assert . calledOnce ( inExperimentStub ) ;
193
168
sinon . assert . calledOnce ( getWorkspaceFolderStub ) ;
194
169
sinon . assert . calledOnce ( isGlobalPythonSelectedStub ) ;
195
170
@@ -198,7 +173,6 @@ suite('Global Pip in Terminal Trigger', () => {
198
173
199
174
test ( 'Should not prompt to create environment if command does not start with pip install' , async ( ) => {
200
175
shouldPromptToCreateEnvStub . returns ( true ) ;
201
- inExperimentStub . returns ( true ) ;
202
176
isGlobalPythonSelectedStub . returns ( true ) ;
203
177
204
178
const disposables : Disposable [ ] = [ ] ;
@@ -223,7 +197,6 @@ suite('Global Pip in Terminal Trigger', () => {
223
197
224
198
assert . strictEqual ( disposables . length , 1 ) ;
225
199
sinon . assert . calledOnce ( shouldPromptToCreateEnvStub ) ;
226
- sinon . assert . calledOnce ( inExperimentStub ) ;
227
200
sinon . assert . calledOnce ( getWorkspaceFolderStub ) ;
228
201
sinon . assert . calledOnce ( isGlobalPythonSelectedStub ) ;
229
202
@@ -233,7 +206,6 @@ suite('Global Pip in Terminal Trigger', () => {
233
206
[ 'pip install' , 'pip3 install' , 'python -m pip install' , 'python3 -m pip install' ] . forEach ( ( command ) => {
234
207
test ( `Should prompt to create environment if all conditions are met: ${ command } ` , async ( ) => {
235
208
shouldPromptToCreateEnvStub . returns ( true ) ;
236
- inExperimentStub . returns ( true ) ;
237
209
isGlobalPythonSelectedStub . returns ( true ) ;
238
210
showWarningMessageStub . resolves ( CreateEnv . Trigger . createEnvironment ) ;
239
211
@@ -259,11 +231,9 @@ suite('Global Pip in Terminal Trigger', () => {
259
231
260
232
assert . strictEqual ( disposables . length , 1 ) ;
261
233
sinon . assert . calledOnce ( shouldPromptToCreateEnvStub ) ;
262
- sinon . assert . calledOnce ( inExperimentStub ) ;
263
234
sinon . assert . calledOnce ( getWorkspaceFolderStub ) ;
264
235
sinon . assert . calledOnce ( isGlobalPythonSelectedStub ) ;
265
236
sinon . assert . calledOnce ( showWarningMessageStub ) ;
266
-
267
237
sinon . assert . calledOnce ( executeCommandStub ) ;
268
238
sinon . assert . notCalled ( disableCreateEnvironmentTriggerStub ) ;
269
239
@@ -273,7 +243,7 @@ suite('Global Pip in Terminal Trigger', () => {
273
243
274
244
test ( "Should disable create environment trigger if user selects don't show again" , async ( ) => {
275
245
shouldPromptToCreateEnvStub . returns ( true ) ;
276
- inExperimentStub . returns ( true ) ;
246
+
277
247
isGlobalPythonSelectedStub . returns ( true ) ;
278
248
showWarningMessageStub . resolves ( Common . doNotShowAgain ) ;
279
249
@@ -299,11 +269,9 @@ suite('Global Pip in Terminal Trigger', () => {
299
269
300
270
assert . strictEqual ( disposables . length , 1 ) ;
301
271
sinon . assert . calledOnce ( shouldPromptToCreateEnvStub ) ;
302
- sinon . assert . calledOnce ( inExperimentStub ) ;
303
272
sinon . assert . calledOnce ( getWorkspaceFolderStub ) ;
304
273
sinon . assert . calledOnce ( isGlobalPythonSelectedStub ) ;
305
274
sinon . assert . calledOnce ( showWarningMessageStub ) ;
306
-
307
275
sinon . assert . notCalled ( executeCommandStub ) ;
308
276
sinon . assert . calledOnce ( disableCreateEnvironmentTriggerStub ) ;
309
277
} ) ;
0 commit comments