Skip to content

Commit c79f3cd

Browse files
Fix tests for KnownSearchPathsForInterpreters.
1 parent 5258b7f commit c79f3cd

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎src/client/pythonEnvironments/discovery/locators/services/KnownPathsService.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// tslint:disable:no-require-imports no-var-requires no-unnecessary-callback-wrapper
2+
// tslint:disable-next-line:no-single-line-block-comment
3+
/* eslint-disable max-classes-per-file */
4+
25
import { inject, injectable } from 'inversify';
36
import * as path from 'path';
4-
import { Uri } from 'vscode';
57
import { IFileSystem, IPlatformService } from '../../../../common/platform/types';
68
import { ICurrentProcess, IPathUtils } from '../../../../common/types';
79
import { IInterpreterHelper, IKnownSearchPathsForInterpreters } from '../../../../interpreter/contracts';
@@ -10,6 +12,7 @@ import { EnvironmentType, PythonEnvironment } from '../../../info';
1012
import { lookForInterpretersInDirectory } from '../helpers';
1113
import { CacheableLocatorService } from './cacheableLocatorService';
1214

15+
// eslint-disable-next-line global-require
1316
const flatten = require('lodash/flatten') as typeof import('lodash/flatten');
1417

1518
/**
@@ -30,15 +33,17 @@ export class KnownPathsService extends CacheableLocatorService {
3033
*
3134
* Called by VS Code to indicate it is done with the resource.
3235
*/
33-
// tslint:disable-next-line:no-empty
34-
public dispose() {}
36+
// tslint:disable:no-empty
37+
// eslint-disable-next-line @typescript-eslint/no-empty-function,class-methods-use-this
38+
public dispose(): void {}
39+
// tslint:enable:no-empty
3540

3641
/**
3742
* Return the located interpreters.
3843
*
3944
* This is used by CacheableLocatorService.getInterpreters().
4045
*/
41-
protected getInterpretersImplementation(_resource?: Uri): Promise<PythonEnvironment[]> {
46+
protected getInterpretersImplementation(): Promise<PythonEnvironment[]> {
4247
return this.suggestionsFromKnownPaths();
4348
}
4449

@@ -66,7 +71,7 @@ export class KnownPathsService extends CacheableLocatorService {
6671
private async getInterpreterDetails(interpreter: string) {
6772
const details = await this.helper.getInterpreterInformation(interpreter);
6873
if (!details) {
69-
return;
74+
return undefined;
7075
}
7176
this._hasInterpreters.resolve(true);
7277
return {
@@ -109,7 +114,7 @@ export class KnownSearchPathsForInterpreters implements IKnownSearchPathsForInte
109114
searchPaths.push(path.join(pathUtils.home, p));
110115
});
111116
// Add support for paths such as /Users/xxx/anaconda/bin.
112-
if (process.env.HOME) {
117+
if (pathUtils.home && pathUtils.home !== '') {
113118
searchPaths.push(path.join(pathUtils.home, 'anaconda', 'bin'));
114119
searchPaths.push(path.join(pathUtils.home, 'python', 'bin'));
115120
}

0 commit comments

Comments
 (0)