@@ -26,12 +26,12 @@ import { sleep } from './core';
26
26
import { PythonEnvKind , PythonEnvSource } from '../client/pythonEnvironments/base/info' ;
27
27
import { Architecture } from '../client/common/utils/platform' ;
28
28
import { PythonEnvCollectionChangedEvent } from '../client/pythonEnvironments/base/watcher' ;
29
+ import { normCasePath } from '../client/common/platform/fs-paths' ;
29
30
import {
30
- ProposedExtensionAPI ,
31
31
ActiveEnvironmentIdChangeEvent ,
32
32
EnvironmentsChangeEvent ,
33
+ ProposedExtensionAPI ,
33
34
} from '../client/proposedApiTypes' ;
34
- import { normCasePath } from '../client/common/platform/fs-paths' ;
35
35
36
36
suite ( 'Proposed Extension API' , ( ) => {
37
37
let serviceContainer : typemoq . IMock < IServiceContainer > ;
@@ -75,7 +75,7 @@ suite('Proposed Extension API', () => {
75
75
76
76
test ( 'Provide an event to track when active environment details change' , async ( ) => {
77
77
const events : ActiveEnvironmentIdChangeEvent [ ] = [ ] ;
78
- proposed . environment . onDidChangeActiveEnvironmentId ( ( e ) => {
78
+ proposed . environment . onDidChangeActiveEnvironmentPath ( ( e ) => {
79
79
events . push ( e ) ;
80
80
} ) ;
81
81
reportActiveInterpreterChanged ( { path : 'path/to/environment' , resource : undefined } ) ;
@@ -85,31 +85,31 @@ suite('Proposed Extension API', () => {
85
85
] ) ;
86
86
} ) ;
87
87
88
- test ( 'getActiveEnvironmentId : No resource' , ( ) => {
88
+ test ( 'getActiveEnvironmentPath : No resource' , ( ) => {
89
89
const pythonPath = 'this/is/a/test/path' ;
90
90
configService
91
91
. setup ( ( c ) => c . getSettings ( undefined ) )
92
92
. returns ( ( ) => ( ( { pythonPath } as unknown ) as IPythonSettings ) ) ;
93
- const actual = proposed . environment . getActiveEnvironmentId ( ) ;
93
+ const actual = proposed . environment . getActiveEnvironmentPath ( ) ;
94
94
assert . deepEqual ( actual , { id : normCasePath ( pythonPath ) , path : pythonPath } ) ;
95
95
} ) ;
96
96
97
- test ( 'getActiveEnvironmentId : default python' , ( ) => {
97
+ test ( 'getActiveEnvironmentPath : default python' , ( ) => {
98
98
const pythonPath = 'python' ;
99
99
configService
100
100
. setup ( ( c ) => c . getSettings ( undefined ) )
101
101
. returns ( ( ) => ( ( { pythonPath } as unknown ) as IPythonSettings ) ) ;
102
- const actual = proposed . environment . getActiveEnvironmentId ( ) ;
102
+ const actual = proposed . environment . getActiveEnvironmentPath ( ) ;
103
103
assert . deepEqual ( actual , { id : 'DEFAULT_PYTHON' , path : pythonPath } ) ;
104
104
} ) ;
105
105
106
- test ( 'getActiveEnvironmentId : With resource' , ( ) => {
106
+ test ( 'getActiveEnvironmentPath : With resource' , ( ) => {
107
107
const pythonPath = 'this/is/a/test/path' ;
108
108
const resource = Uri . file ( __filename ) ;
109
109
configService
110
110
. setup ( ( c ) => c . getSettings ( resource ) )
111
111
. returns ( ( ) => ( ( { pythonPath } as unknown ) as IPythonSettings ) ) ;
112
- const actual = proposed . environment . getActiveEnvironmentId ( resource ) ;
112
+ const actual = proposed . environment . getActiveEnvironmentPath ( resource ) ;
113
113
assert . deepEqual ( actual , { id : normCasePath ( pythonPath ) , path : pythonPath } ) ;
114
114
} ) ;
115
115
@@ -317,44 +317,44 @@ suite('Proposed Extension API', () => {
317
317
assert . deepEqual ( eventValues , expectedEvents ) ;
318
318
} ) ;
319
319
320
- test ( 'updateActiveEnvironmentId : no resource' , async ( ) => {
320
+ test ( 'updateActiveEnvironmentPath : no resource' , async ( ) => {
321
321
interpreterPathService
322
322
. setup ( ( i ) => i . update ( undefined , ConfigurationTarget . WorkspaceFolder , 'this/is/a/test/python/path' ) )
323
323
. returns ( ( ) => Promise . resolve ( ) )
324
324
. verifiable ( typemoq . Times . once ( ) ) ;
325
325
326
- await proposed . environment . updateActiveEnvironmentId ( 'this/is/a/test/python/path' ) ;
326
+ await proposed . environment . updateActiveEnvironmentPath ( 'this/is/a/test/python/path' ) ;
327
327
328
328
interpreterPathService . verifyAll ( ) ;
329
329
} ) ;
330
330
331
- test ( 'updateActiveEnvironmentId : passed as Environment' , async ( ) => {
331
+ test ( 'updateActiveEnvironmentPath : passed as Environment' , async ( ) => {
332
332
interpreterPathService
333
333
. setup ( ( i ) => i . update ( undefined , ConfigurationTarget . WorkspaceFolder , 'this/is/a/test/python/path' ) )
334
334
. returns ( ( ) => Promise . resolve ( ) )
335
335
. verifiable ( typemoq . Times . once ( ) ) ;
336
336
337
- await proposed . environment . updateActiveEnvironmentId ( {
337
+ await proposed . environment . updateActiveEnvironmentPath ( {
338
338
id : normCasePath ( 'this/is/a/test/python/path' ) ,
339
339
path : 'this/is/a/test/python/path' ,
340
340
} ) ;
341
341
342
342
interpreterPathService . verifyAll ( ) ;
343
343
} ) ;
344
344
345
- test ( 'updateActiveEnvironmentId : with uri' , async ( ) => {
345
+ test ( 'updateActiveEnvironmentPath : with uri' , async ( ) => {
346
346
const uri = Uri . parse ( 'a' ) ;
347
347
interpreterPathService
348
348
. setup ( ( i ) => i . update ( uri , ConfigurationTarget . WorkspaceFolder , 'this/is/a/test/python/path' ) )
349
349
. returns ( ( ) => Promise . resolve ( ) )
350
350
. verifiable ( typemoq . Times . once ( ) ) ;
351
351
352
- await proposed . environment . updateActiveEnvironmentId ( 'this/is/a/test/python/path' , uri ) ;
352
+ await proposed . environment . updateActiveEnvironmentPath ( 'this/is/a/test/python/path' , uri ) ;
353
353
354
354
interpreterPathService . verifyAll ( ) ;
355
355
} ) ;
356
356
357
- test ( 'updateActiveEnvironmentId : with workspace folder' , async ( ) => {
357
+ test ( 'updateActiveEnvironmentPath : with workspace folder' , async ( ) => {
358
358
const uri = Uri . parse ( 'a' ) ;
359
359
interpreterPathService
360
360
. setup ( ( i ) => i . update ( uri , ConfigurationTarget . WorkspaceFolder , 'this/is/a/test/python/path' ) )
@@ -366,7 +366,7 @@ suite('Proposed Extension API', () => {
366
366
index : 0 ,
367
367
} ;
368
368
369
- await proposed . environment . updateActiveEnvironmentId ( 'this/is/a/test/python/path' , workspace ) ;
369
+ await proposed . environment . updateActiveEnvironmentPath ( 'this/is/a/test/python/path' , workspace ) ;
370
370
371
371
interpreterPathService . verifyAll ( ) ;
372
372
} ) ;
0 commit comments