@@ -36,6 +36,7 @@ suite('Conda Creation provider tests', () => {
3636 let withProgressStub : sinon . SinonStub ;
3737 let showErrorMessageWithLogsStub : sinon . SinonStub ;
3838 let pickExistingCondaActionStub : sinon . SinonStub ;
39+ let getPrefixCondaEnvPathStub : sinon . SinonStub ;
3940
4041 setup ( ( ) => {
4142 pickWorkspaceFolderStub = sinon . stub ( wsSelect , 'pickWorkspaceFolder' ) ;
@@ -50,6 +51,8 @@ suite('Conda Creation provider tests', () => {
5051 pickExistingCondaActionStub = sinon . stub ( condaUtils , 'pickExistingCondaAction' ) ;
5152 pickExistingCondaActionStub . resolves ( condaUtils . ExistingCondaAction . Create ) ;
5253
54+ getPrefixCondaEnvPathStub = sinon . stub ( commonUtils , 'getPrefixCondaEnvPath' ) ;
55+
5356 progressMock = typemoq . Mock . ofType < CreateEnvironmentProgress > ( ) ;
5457 condaProvider = condaCreationProvider ( ) ;
5558 } ) ;
@@ -254,4 +257,24 @@ suite('Conda Creation provider tests', () => {
254257 assert . isTrue ( showErrorMessageWithLogsStub . calledOnce ) ;
255258 assert . isTrue ( pickExistingCondaActionStub . calledOnce ) ;
256259 } ) ;
260+
261+ test ( 'Use existing conda environment' , async ( ) => {
262+ getCondaBaseEnvStub . resolves ( '/usr/bin/conda' ) ;
263+ const workspace1 = {
264+ uri : Uri . file ( path . join ( EXTENSION_ROOT_DIR_FOR_TESTS , 'src' , 'testMultiRootWkspc' , 'workspace1' ) ) ,
265+ name : 'workspace1' ,
266+ index : 0 ,
267+ } ;
268+ pickWorkspaceFolderStub . resolves ( workspace1 ) ;
269+ pickExistingCondaActionStub . resolves ( condaUtils . ExistingCondaAction . UseExisting ) ;
270+ getPrefixCondaEnvPathStub . returns ( 'existing_environment' ) ;
271+
272+ const result = await condaProvider . createEnvironment ( ) ;
273+ assert . isTrue ( showErrorMessageWithLogsStub . notCalled ) ;
274+ assert . isTrue ( pickPythonVersionStub . notCalled ) ;
275+ assert . isTrue ( execObservableStub . notCalled ) ;
276+ assert . isTrue ( withProgressStub . notCalled ) ;
277+
278+ assert . deepStrictEqual ( result , { path : 'existing_environment' , workspaceFolder : workspace1 } ) ;
279+ } ) ;
257280} ) ;
0 commit comments