@@ -45,7 +45,8 @@ suite('Debugging - Adapter Factory', () => {
45
45
let spiedInstance : ExperimentsManager ;
46
46
47
47
const nodeExecutable = { command : 'node' , args : [ ] } ;
48
- const ptvsdAdapterPath = path . join ( EXTENSION_ROOT_DIR , 'pythonFiles' , 'lib' , 'python' , 'ptvsd' , 'adapter' ) ;
48
+ const ptvsdAdapterPathWithWheels = path . join ( EXTENSION_ROOT_DIR , 'pythonFiles' , 'lib' , 'python' , 'new_ptvsd' , 'wheels' , 'ptvsd' , 'adapter' ) ;
49
+ const ptvsdAdapterPathWithoutWheels = path . join ( EXTENSION_ROOT_DIR , 'pythonFiles' , 'lib' , 'python' , 'new_ptvsd' , 'no_wheels' , 'ptvsd' , 'adapter' ) ;
49
50
const pythonPath = path . join ( 'path' , 'to' , 'python' , 'interpreter' ) ;
50
51
const interpreter = {
51
52
architecture : Architecture . Unknown ,
@@ -55,6 +56,15 @@ suite('Debugging - Adapter Factory', () => {
55
56
type : InterpreterType . Unknown ,
56
57
version : new SemVer ( '3.7.4-test' )
57
58
} ;
59
+ const python36Path = path . join ( 'path' , 'to' , 'active' , 'interpreter' ) ;
60
+ const interpreterPython36Details = {
61
+ architecture : Architecture . Unknown ,
62
+ path : python36Path ,
63
+ sysPrefix : '' ,
64
+ sysVersion : '' ,
65
+ type : InterpreterType . Unknown ,
66
+ version : new SemVer ( '3.6.8-test' )
67
+ } ;
58
68
const oldValueOfVSC_PYTHON_UNIT_TEST = process . env . VSC_PYTHON_UNIT_TEST ;
59
69
const oldValueOfVSC_PYTHON_CI_TEST = process . env . VSC_PYTHON_CI_TEST ;
60
70
@@ -103,11 +113,7 @@ suite('Debugging - Adapter Factory', () => {
103
113
when ( interpreterService . getInterpreterDetails ( pythonPath ) ) . thenResolve ( interpreter ) ;
104
114
when ( interpreterService . getInterpreters ( anything ( ) ) ) . thenResolve ( [ interpreter ] ) ;
105
115
106
- factory = new DebugAdapterDescriptorFactory (
107
- instance ( interpreterService ) ,
108
- instance ( appShell ) ,
109
- experimentsManager
110
- ) ;
116
+ factory = new DebugAdapterDescriptorFactory ( instance ( interpreterService ) , instance ( appShell ) , experimentsManager ) ;
111
117
} ) ;
112
118
113
119
teardown ( ( ) => {
@@ -133,7 +139,7 @@ suite('Debugging - Adapter Factory', () => {
133
139
134
140
test ( 'Return the value of configuration.pythonPath as the current python path if it exists and if we are in the experiment' , async ( ) => {
135
141
const session = createSession ( { pythonPath } ) ;
136
- const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPath ] ) ;
142
+ const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPathWithWheels ] ) ;
137
143
138
144
when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
139
145
@@ -144,7 +150,7 @@ suite('Debugging - Adapter Factory', () => {
144
150
145
151
test ( 'Return the path of the active interpreter as the current python path if we are in the experiment, it exists and configuration.pythonPath is not defined' , async ( ) => {
146
152
const session = createSession ( { } ) ;
147
- const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPath ] ) ;
153
+ const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPathWithWheels ] ) ;
148
154
149
155
when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
150
156
when ( interpreterService . getActiveInterpreter ( anything ( ) ) ) . thenResolve ( interpreter ) ;
@@ -156,7 +162,7 @@ suite('Debugging - Adapter Factory', () => {
156
162
157
163
test ( 'Return the path of the first available interpreter as the current python path if we are in the experiment, configuration.pythonPath is not defined and there is no active interpreter' , async ( ) => {
158
164
const session = createSession ( { } ) ;
159
- const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPath ] ) ;
165
+ const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPathWithWheels ] ) ;
160
166
161
167
when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
162
168
@@ -213,27 +219,21 @@ suite('Debugging - Adapter Factory', () => {
213
219
assert . deepEqual ( descriptor , nodeExecutable ) ;
214
220
} ) ;
215
221
216
- test ( 'Return old node debugger when the active interpreter is not Python 3.7' , async ( ) => {
217
- const python36Path = path . join ( 'path' , 'to' , 'active' , 'interpreter' ) ;
218
- const interpreterPython36Details = {
219
- architecture : Architecture . Unknown ,
220
- path : pythonPath ,
221
- sysPrefix : '' ,
222
- sysVersion : '' ,
223
- type : InterpreterType . Unknown ,
224
- version : new SemVer ( '3.6.8-test' )
225
- } ;
222
+ test ( 'Return Python debug adapter without wheels executable when the active interpreter is not Python 3.7' , async ( ) => {
223
+ const debugExecutable = new DebugAdapterExecutable ( python36Path , [ ptvsdAdapterPathWithoutWheels ] ) ;
226
224
const session = createSession ( { } ) ;
227
225
226
+ when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
227
+ when ( interpreterService . getInterpreters ( anything ( ) ) ) . thenResolve ( [ interpreterPython36Details ] ) ;
228
228
when ( interpreterService . getInterpreterDetails ( python36Path ) ) . thenResolve ( interpreterPython36Details ) ;
229
229
230
230
const descriptor = await factory . createDebugAdapterDescriptor ( session , nodeExecutable ) ;
231
231
232
- assert . deepEqual ( descriptor , nodeExecutable ) ;
232
+ assert . deepEqual ( descriptor , debugExecutable ) ;
233
233
} ) ;
234
234
235
- test ( 'Return Python debug adapter executable when in the experiment and with the active interpreter being Python 3.7' , async ( ) => {
236
- const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPath ] ) ;
235
+ test ( 'Return Python debug adapter with wheels executable when in the experiment and with the active interpreter being Python 3.7' , async ( ) => {
236
+ const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPathWithWheels ] ) ;
237
237
const session = createSession ( { } ) ;
238
238
239
239
when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
@@ -250,9 +250,9 @@ suite('Debugging - Adapter Factory', () => {
250
250
await expect ( promise ) . to . eventually . be . rejectedWith ( 'Debug Adapter Executable not provided' ) ;
251
251
} ) ;
252
252
253
- test ( 'Pass the --log-dir argument to PTVSD is configuration.logToFile is set' , async ( ) => {
253
+ test ( 'Pass the --log-dir argument to PTVSD if configuration.logToFile is set, with active interpreter Python 3.7 ' , async ( ) => {
254
254
const session = createSession ( { logToFile : true } ) ;
255
- const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPath , '--log-dir' , EXTENSION_ROOT_DIR ] ) ;
255
+ const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPathWithWheels , '--log-dir' , EXTENSION_ROOT_DIR ] ) ;
256
256
257
257
when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
258
258
@@ -261,9 +261,22 @@ suite('Debugging - Adapter Factory', () => {
261
261
assert . deepEqual ( descriptor , debugExecutable ) ;
262
262
} ) ;
263
263
264
- test ( 'Don\'t pass the --log-dir argument to PTVSD is configuration.logToFile is not set' , async ( ) => {
264
+ test ( 'Pass the --log-dir argument to PTVSD if configuration.logToFile is set, with active interpreter not Python 3.7' , async ( ) => {
265
+ const session = createSession ( { logToFile : true } ) ;
266
+ const debugExecutable = new DebugAdapterExecutable ( python36Path , [ ptvsdAdapterPathWithoutWheels , '--log-dir' , EXTENSION_ROOT_DIR ] ) ;
267
+
268
+ when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
269
+ when ( interpreterService . getInterpreters ( anything ( ) ) ) . thenResolve ( [ interpreterPython36Details ] ) ;
270
+ when ( interpreterService . getInterpreterDetails ( python36Path ) ) . thenResolve ( interpreterPython36Details ) ;
271
+
272
+ const descriptor = await factory . createDebugAdapterDescriptor ( session , nodeExecutable ) ;
273
+
274
+ assert . deepEqual ( descriptor , debugExecutable ) ;
275
+ } ) ;
276
+
277
+ test ( 'Don\'t pass the --log-dir argument to PTVSD if configuration.logToFile is not set, with active interpreter Python 3.7' , async ( ) => {
265
278
const session = createSession ( { } ) ;
266
- const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPath ] ) ;
279
+ const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPathWithWheels ] ) ;
267
280
268
281
when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
269
282
@@ -272,25 +285,63 @@ suite('Debugging - Adapter Factory', () => {
272
285
assert . deepEqual ( descriptor , debugExecutable ) ;
273
286
} ) ;
274
287
275
- test ( 'Don\'t pass the --log-dir argument to PTVSD is configuration.logToFile is set but false' , async ( ) => {
288
+ test ( 'Don\'t pass the --log-dir argument to PTVSD if configuration.logToFile is not set, with active interpreter not Python 3.7' , async ( ) => {
289
+ const session = createSession ( { } ) ;
290
+ const debugExecutable = new DebugAdapterExecutable ( python36Path , [ ptvsdAdapterPathWithoutWheels ] ) ;
291
+
292
+ when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
293
+ when ( interpreterService . getInterpreters ( anything ( ) ) ) . thenResolve ( [ interpreterPython36Details ] ) ;
294
+ when ( interpreterService . getInterpreterDetails ( python36Path ) ) . thenResolve ( interpreterPython36Details ) ;
295
+
296
+ const descriptor = await factory . createDebugAdapterDescriptor ( session , nodeExecutable ) ;
297
+
298
+ assert . deepEqual ( descriptor , debugExecutable ) ;
299
+ } ) ;
300
+
301
+ test ( 'Don\'t pass the --log-dir argument to PTVSD if configuration.logToFile is set but false, with active interpreter Python 3.7' , async ( ) => {
302
+ const session = createSession ( { logToFile : false } ) ;
303
+ const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPathWithWheels ] ) ;
304
+
305
+ when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
306
+
307
+ const descriptor = await factory . createDebugAdapterDescriptor ( session , nodeExecutable ) ;
308
+
309
+ assert . deepEqual ( descriptor , debugExecutable ) ;
310
+ } ) ;
311
+
312
+ test ( 'Don\'t pass the --log-dir argument to PTVSD if configuration.logToFile is set but false, with active interpreter not Python 3.7' , async ( ) => {
276
313
const session = createSession ( { logToFile : false } ) ;
277
- const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ ptvsdAdapterPath ] ) ;
314
+ const debugExecutable = new DebugAdapterExecutable ( python36Path , [ ptvsdAdapterPathWithoutWheels ] ) ;
278
315
279
316
when ( spiedInstance . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) . thenReturn ( true ) ;
317
+ when ( interpreterService . getInterpreters ( anything ( ) ) ) . thenResolve ( [ interpreterPython36Details ] ) ;
318
+ when ( interpreterService . getInterpreterDetails ( python36Path ) ) . thenResolve ( interpreterPython36Details ) ;
280
319
281
320
const descriptor = await factory . createDebugAdapterDescriptor ( session , nodeExecutable ) ;
282
321
283
322
assert . deepEqual ( descriptor , debugExecutable ) ;
284
323
} ) ;
285
324
286
- test ( 'Send experiment group telemetry if inside the wheels experiment' , async ( ) => {
325
+ test ( 'Send experiment group telemetry if inside the wheels experiment, with active interpreter Python 3.7 ' , async ( ) => {
287
326
const session = createSession ( { } ) ;
288
327
when ( spiedInstance . userExperiments ) . thenReturn ( [ { name : DebugAdapterNewPtvsd . experiment , salt : DebugAdapterNewPtvsd . experiment , min : 0 , max : 0 } ] ) ;
289
328
290
329
await factory . createDebugAdapterDescriptor ( session , nodeExecutable ) ;
291
330
292
- assert . deepEqual ( Reporter . eventNames , [ EventName . PYTHON_EXPERIMENTS ] ) ;
293
- assert . deepEqual ( Reporter . properties , [ { expName : DebugAdapterNewPtvsd . experiment } ] ) ;
331
+ assert . deepEqual ( Reporter . eventNames , [ EventName . PYTHON_EXPERIMENTS , EventName . DEBUG_ADAPTER_USING_WHEELS_PATH ] ) ;
332
+ assert . deepEqual ( Reporter . properties , [ { expName : DebugAdapterNewPtvsd . experiment } , { usingWheels : 'true' } ] ) ;
333
+ } ) ;
334
+
335
+ test ( 'Send experiment group telemetry if inside the wheels experiment, with active interpreter not Python 3.6' , async ( ) => {
336
+ const session = createSession ( { } ) ;
337
+ when ( spiedInstance . userExperiments ) . thenReturn ( [ { name : DebugAdapterNewPtvsd . experiment , salt : DebugAdapterNewPtvsd . experiment , min : 0 , max : 0 } ] ) ;
338
+ when ( interpreterService . getInterpreters ( anything ( ) ) ) . thenResolve ( [ interpreterPython36Details ] ) ;
339
+ when ( interpreterService . getInterpreterDetails ( python36Path ) ) . thenResolve ( interpreterPython36Details ) ;
340
+
341
+ await factory . createDebugAdapterDescriptor ( session , nodeExecutable ) ;
342
+
343
+ assert . deepEqual ( Reporter . eventNames , [ EventName . PYTHON_EXPERIMENTS , EventName . DEBUG_ADAPTER_USING_WHEELS_PATH ] ) ;
344
+ assert . deepEqual ( Reporter . properties , [ { expName : DebugAdapterNewPtvsd . experiment } , { usingWheels : 'false' } ] ) ;
294
345
} ) ;
295
346
296
347
test ( 'Send control group telemetry if inside the DA experiment control group' , async ( ) => {
0 commit comments