@@ -9,7 +9,7 @@ import { Architecture, IFileSystem, IPlatformService } from '../../client/common
99import { IProcessService , IProcessServiceFactory } from '../../client/common/process/types' ;
1010import { ILogger , IPersistentStateFactory } from '../../client/common/types' ;
1111import { IInterpreterLocatorService , InterpreterType , PythonInterpreter } from '../../client/interpreter/contracts' ;
12- import { CondaService , KNOWN_CONDA_LOCATIONS } from '../../client/interpreter/locators/services/condaService' ;
12+ import { CondaService } from '../../client/interpreter/locators/services/condaService' ;
1313import { IServiceContainer } from '../../client/ioc/types' ;
1414import { MockState } from './mocks' ;
1515
@@ -356,21 +356,25 @@ suite('Interpreters Conda Service', () => {
356356 processService . verify ( p => p . exec ( TypeMoq . It . isAny ( ) , TypeMoq . It . isAny ( ) , TypeMoq . It . isAny ( ) ) , TypeMoq . Times . once ( ) ) ;
357357 } ) ;
358358
359- KNOWN_CONDA_LOCATIONS . forEach ( knownLocation => {
360- test ( `Must return conda path from known location '${ knownLocation } ' (non windows)` , async ( ) => {
361- const expectedCondaLocation = untildify ( knownLocation ) ;
362- platformService . setup ( p => p . isWindows ) . returns ( ( ) => false ) ;
363- processService . setup ( p => p . exec ( TypeMoq . It . isValue ( 'conda' ) , TypeMoq . It . isValue ( [ '--version' ] ) , TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => Promise . reject ( new Error ( 'Not Found' ) ) ) ;
364- fileSystem . setup ( fs => fs . fileExists ( TypeMoq . It . isAny ( ) ) ) . returns ( ( file : string ) => Promise . resolve ( file === expectedCondaLocation ) ) ;
359+ [ '~/anaconda/bin/conda' , '~/miniconda/bin/conda' , '~/anaconda2/bin/conda' ,
360+ '~/miniconda2/bin/conda' , '~/anaconda3/bin/conda' , '~/miniconda3/bin/conda' ]
361+ . forEach ( knownLocation => {
362+ test ( `Must return conda path from known location '${ knownLocation } ' (non windows)` , async ( ) => {
363+ const expectedCondaLocation = untildify ( knownLocation ) ;
364+ platformService . setup ( p => p . isWindows ) . returns ( ( ) => false ) ;
365+ processService . setup ( p => p . exec ( TypeMoq . It . isValue ( 'conda' ) , TypeMoq . It . isValue ( [ '--version' ] ) , TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => Promise . reject ( new Error ( 'Not Found' ) ) ) ;
366+ fileSystem . setup ( fs => fs . search ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => Promise . resolve ( [ expectedCondaLocation ] ) ) ;
367+ fileSystem . setup ( fs => fs . fileExists ( TypeMoq . It . isValue ( expectedCondaLocation ) ) ) . returns ( ( ) => Promise . resolve ( true ) ) ;
365368
366- const condaExe = await condaService . getCondaFile ( ) ;
367- assert . equal ( condaExe , expectedCondaLocation , 'Failed to identify' ) ;
369+ const condaExe = await condaService . getCondaFile ( ) ;
370+ assert . equal ( condaExe , expectedCondaLocation , 'Failed to identify' ) ;
371+ } ) ;
368372 } ) ;
369- } ) ;
370373
371374 test ( 'Must return \'conda\' if conda could not be found in known locations' , async ( ) => {
372375 platformService . setup ( p => p . isWindows ) . returns ( ( ) => false ) ;
373376 processService . setup ( p => p . exec ( TypeMoq . It . isValue ( 'conda' ) , TypeMoq . It . isValue ( [ '--version' ] ) , TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => Promise . reject ( new Error ( 'Not Found' ) ) ) ;
377+ fileSystem . setup ( fs => fs . search ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => Promise . resolve ( [ ] ) ) ;
374378 fileSystem . setup ( fs => fs . fileExists ( TypeMoq . It . isAny ( ) ) ) . returns ( ( file : string ) => Promise . resolve ( false ) ) ;
375379
376380 const condaExe = await condaService . getCondaFile ( ) ;
0 commit comments