@@ -29,7 +29,6 @@ import { PythonEnvCollectionChangedEvent } from '../client/pythonEnvironments/ba
29
29
import { normCasePath } from '../client/common/platform/fs-paths' ;
30
30
import {
31
31
ActiveEnvironmentPathChangeEvent ,
32
- EnvironmentPath ,
33
32
EnvironmentsChangeEvent ,
34
33
ProposedExtensionAPI ,
35
34
} from '../client/proposedApiTypes' ;
@@ -76,7 +75,7 @@ suite('Proposed Extension API', () => {
76
75
77
76
test ( 'Provide an event to track when active environment details change' , async ( ) => {
78
77
const events : ActiveEnvironmentPathChangeEvent [ ] = [ ] ;
79
- proposed . environment . onDidChangeActiveEnvironmentPath ( ( e ) => {
78
+ proposed . environments . onDidChangeActiveEnvironmentPath ( ( e ) => {
80
79
events . push ( e ) ;
81
80
} ) ;
82
81
reportActiveInterpreterChanged ( { path : 'path/to/environment' , resource : undefined } ) ;
@@ -91,25 +90,23 @@ suite('Proposed Extension API', () => {
91
90
configService
92
91
. setup ( ( c ) => c . getSettings ( undefined ) )
93
92
. returns ( ( ) => ( ( { pythonPath } as unknown ) as IPythonSettings ) ) ;
94
- const actual = proposed . environment . getActiveEnvironmentPath ( ) ;
95
- assert . deepEqual ( actual , ( {
93
+ const actual = proposed . environments . getActiveEnvironmentPath ( ) ;
94
+ assert . deepEqual ( actual , {
96
95
id : normCasePath ( pythonPath ) ,
97
96
path : pythonPath ,
98
- pathType : 'interpreterPath' ,
99
- } as unknown ) as EnvironmentPath ) ;
97
+ } ) ;
100
98
} ) ;
101
99
102
100
test ( 'getActiveEnvironmentPath: default python' , ( ) => {
103
101
const pythonPath = 'python' ;
104
102
configService
105
103
. setup ( ( c ) => c . getSettings ( undefined ) )
106
104
. returns ( ( ) => ( ( { pythonPath } as unknown ) as IPythonSettings ) ) ;
107
- const actual = proposed . environment . getActiveEnvironmentPath ( ) ;
108
- assert . deepEqual ( actual , ( {
105
+ const actual = proposed . environments . getActiveEnvironmentPath ( ) ;
106
+ assert . deepEqual ( actual , {
109
107
id : 'DEFAULT_PYTHON' ,
110
108
path : pythonPath ,
111
- pathType : 'interpreterPath' ,
112
- } as unknown ) as EnvironmentPath ) ;
109
+ } ) ;
113
110
} ) ;
114
111
115
112
test ( 'getActiveEnvironmentPath: With resource' , ( ) => {
@@ -118,19 +115,18 @@ suite('Proposed Extension API', () => {
118
115
configService
119
116
. setup ( ( c ) => c . getSettings ( resource ) )
120
117
. returns ( ( ) => ( ( { pythonPath } as unknown ) as IPythonSettings ) ) ;
121
- const actual = proposed . environment . getActiveEnvironmentPath ( resource ) ;
122
- assert . deepEqual ( actual , ( {
118
+ const actual = proposed . environments . getActiveEnvironmentPath ( resource ) ;
119
+ assert . deepEqual ( actual , {
123
120
id : normCasePath ( pythonPath ) ,
124
121
path : pythonPath ,
125
- pathType : 'interpreterPath' ,
126
- } as unknown ) as EnvironmentPath ) ;
122
+ } ) ;
127
123
} ) ;
128
124
129
125
test ( 'resolveEnvironment: invalid environment (when passed as string)' , async ( ) => {
130
126
const pythonPath = 'this/is/a/test/path' ;
131
127
discoverAPI . setup ( ( p ) => p . resolveEnv ( pythonPath ) ) . returns ( ( ) => Promise . resolve ( undefined ) ) ;
132
128
133
- const actual = await proposed . environment . resolveEnvironment ( pythonPath ) ;
129
+ const actual = await proposed . environments . resolveEnvironment ( pythonPath ) ;
134
130
expect ( actual ) . to . be . equal ( undefined ) ;
135
131
} ) ;
136
132
@@ -150,7 +146,7 @@ suite('Proposed Extension API', () => {
150
146
} ) ;
151
147
discoverAPI . setup ( ( p ) => p . resolveEnv ( pythonPath ) ) . returns ( ( ) => Promise . resolve ( env ) ) ;
152
148
153
- const actual = await proposed . environment . resolveEnvironment ( pythonPath ) ;
149
+ const actual = await proposed . environments . resolveEnvironment ( pythonPath ) ;
154
150
assert . deepEqual ( ( actual as EnvironmentReference ) . internal , convertCompleteEnvInfo ( env ) ) ;
155
151
} ) ;
156
152
@@ -176,13 +172,13 @@ suite('Proposed Extension API', () => {
176
172
} ) ;
177
173
discoverAPI . setup ( ( p ) => p . resolveEnv ( pythonPath ) ) . returns ( ( ) => Promise . resolve ( env ) ) ;
178
174
179
- const actual = await proposed . environment . resolveEnvironment ( convertCompleteEnvInfo ( partialEnv ) ) ;
175
+ const actual = await proposed . environments . resolveEnvironment ( convertCompleteEnvInfo ( partialEnv ) ) ;
180
176
assert . deepEqual ( ( actual as EnvironmentReference ) . internal , convertCompleteEnvInfo ( env ) ) ;
181
177
} ) ;
182
178
183
179
test ( 'environments: no pythons found' , ( ) => {
184
180
discoverAPI . setup ( ( d ) => d . getEnvs ( ) ) . returns ( ( ) => [ ] ) ;
185
- const actual = proposed . environment . all ;
181
+ const actual = proposed . environments . known ;
186
182
expect ( actual ) . to . be . deep . equal ( [ ] ) ;
187
183
} ) ;
188
184
@@ -232,7 +228,7 @@ suite('Proposed Extension API', () => {
232
228
} ,
233
229
] ;
234
230
discoverAPI . setup ( ( d ) => d . getEnvs ( ) ) . returns ( ( ) => envs ) ;
235
- const actual = proposed . environment . all ;
231
+ const actual = proposed . environments . known ;
236
232
const actualEnvs = actual ?. map ( ( a ) => ( a as EnvironmentReference ) . internal ) ;
237
233
assert . deepEqual (
238
234
actualEnvs ?. sort ( ( a , b ) => a . id . localeCompare ( b . id ) ) ,
@@ -244,7 +240,7 @@ suite('Proposed Extension API', () => {
244
240
let events : EnvironmentsChangeEvent [ ] = [ ] ;
245
241
let eventValues : EnvironmentsChangeEvent [ ] = [ ] ;
246
242
let expectedEvents : EnvironmentsChangeEvent [ ] = [ ] ;
247
- proposed . environment . onDidChangeEnvironments ( ( e ) => {
243
+ proposed . environments . onDidChangeEnvironments ( ( e ) => {
248
244
events . push ( e ) ;
249
245
} ) ;
250
246
const envs = [
@@ -336,7 +332,7 @@ suite('Proposed Extension API', () => {
336
332
. returns ( ( ) => Promise . resolve ( ) )
337
333
. verifiable ( typemoq . Times . once ( ) ) ;
338
334
339
- await proposed . environment . updateActiveEnvironmentPath ( 'this/is/a/test/python/path' ) ;
335
+ await proposed . environments . updateActiveEnvironmentPath ( 'this/is/a/test/python/path' ) ;
340
336
341
337
interpreterPathService . verifyAll ( ) ;
342
338
} ) ;
@@ -347,7 +343,7 @@ suite('Proposed Extension API', () => {
347
343
. returns ( ( ) => Promise . resolve ( ) )
348
344
. verifiable ( typemoq . Times . once ( ) ) ;
349
345
350
- await proposed . environment . updateActiveEnvironmentPath ( {
346
+ await proposed . environments . updateActiveEnvironmentPath ( {
351
347
id : normCasePath ( 'this/is/a/test/python/path' ) ,
352
348
path : 'this/is/a/test/python/path' ,
353
349
} ) ;
@@ -362,7 +358,7 @@ suite('Proposed Extension API', () => {
362
358
. returns ( ( ) => Promise . resolve ( ) )
363
359
. verifiable ( typemoq . Times . once ( ) ) ;
364
360
365
- await proposed . environment . updateActiveEnvironmentPath ( 'this/is/a/test/python/path' , uri ) ;
361
+ await proposed . environments . updateActiveEnvironmentPath ( 'this/is/a/test/python/path' , uri ) ;
366
362
367
363
interpreterPathService . verifyAll ( ) ;
368
364
} ) ;
@@ -379,7 +375,7 @@ suite('Proposed Extension API', () => {
379
375
index : 0 ,
380
376
} ;
381
377
382
- await proposed . environment . updateActiveEnvironmentPath ( 'this/is/a/test/python/path' , workspace ) ;
378
+ await proposed . environments . updateActiveEnvironmentPath ( 'this/is/a/test/python/path' , workspace ) ;
383
379
384
380
interpreterPathService . verifyAll ( ) ;
385
381
} ) ;
@@ -390,7 +386,7 @@ suite('Proposed Extension API', () => {
390
386
. returns ( ( ) => Promise . resolve ( ) )
391
387
. verifiable ( typemoq . Times . once ( ) ) ;
392
388
393
- await proposed . environment . refreshEnvironments ( ) ;
389
+ await proposed . environments . refreshEnvironments ( ) ;
394
390
395
391
discoverAPI . verifyAll ( ) ;
396
392
} ) ;
@@ -401,7 +397,7 @@ suite('Proposed Extension API', () => {
401
397
. returns ( ( ) => Promise . resolve ( ) )
402
398
. verifiable ( typemoq . Times . once ( ) ) ;
403
399
404
- await proposed . environment . refreshEnvironments ( { forceRefresh : true } ) ;
400
+ await proposed . environments . refreshEnvironments ( { forceRefresh : true } ) ;
405
401
406
402
discoverAPI . verifyAll ( ) ;
407
403
} ) ;
0 commit comments