Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup PythonPath related objects #18249

Merged
merged 1 commit into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/client/common/experiments/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,3 @@
export enum ShowExtensionSurveyPrompt {
experiment = 'pythonSurveyNotification',
}

// Feature flag for 'Python: Launch TensorBoard' feature
export enum NativeTensorBoard {
experiment = 'pythonTensorboardExperiment',
}

// Feature gate to control whether we install the PyTorch profiler package
// torch.profiler release is being delayed till end of March. This allows us
// to turn on the profiler plugin install functionality between releases
export enum TorchProfiler {
experiment = 'PythonPyTorchProfiler',
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class PythonPathUpdaterService implements IPythonPathUpdaterServiceManage
failed = true;

const message = reason && typeof reason.message === 'string' ? (reason.message as string) : '';
window.showErrorMessage(`Failed to set 'pythonPath'. Error: ${message}`);
window.showErrorMessage(`Failed to set interpreter path. Error: ${message}`);
traceError(reason);
}
// do not wait for this to complete
Expand Down
11 changes: 1 addition & 10 deletions src/test/interpreters/pythonPathUpdaterFactory.unit.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import * as TypeMoq from 'typemoq';
import { ConfigurationTarget, Uri, WorkspaceConfiguration } from 'vscode';
import { ConfigurationTarget, Uri } from 'vscode';
import { IWorkspaceService } from '../../client/common/application/types';
import { IExperimentService, IInterpreterPathService } from '../../client/common/types';
import { PythonPathUpdaterServiceFactory } from '../../client/interpreter/configuration/pythonPathUpdaterServiceFactory';
Expand Down Expand Up @@ -28,13 +28,6 @@ suite('Python Path Settings Updater', () => {
.returns(() => interpreterPathService.object);
updaterServiceFactory = new PythonPathUpdaterServiceFactory(serviceContainer.object);
}
function setupConfigProvider(resource?: Uri): TypeMoq.IMock<WorkspaceConfiguration> {
const workspaceConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
workspaceService
.setup((w) => w.getConfiguration(TypeMoq.It.isValue('python'), TypeMoq.It.isValue(resource)))
.returns(() => workspaceConfig.object);
return workspaceConfig;
}

suite('Global', () => {
setup(() => setupMocks());
Expand Down Expand Up @@ -106,8 +99,6 @@ suite('Python Path Settings Updater', () => {
const workspaceFolder = Uri.file(workspaceFolderPath);
const pythonPath = Uri.file(path.join(workspaceFolderPath, 'env', 'bin', 'python')).fsPath;
const expectedPythonPath = path.join('env', 'bin', 'python');
const workspaceConfig = setupConfigProvider(workspaceFolder);
workspaceConfig.setup((w) => w.inspect(TypeMoq.It.isValue('pythonPath'))).returns(() => undefined);
interpreterPathService.setup((i) => i.inspect(workspaceFolder)).returns(() => ({}));
interpreterPathService
.setup((i) => i.update(workspaceFolder, ConfigurationTarget.WorkspaceFolder, expectedPythonPath))
Expand Down
5 changes: 0 additions & 5 deletions src/test/mocks/mockWorkspaceConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ export class MockWorkspaceConfiguration implements WorkspaceConfiguration {
const keys = [...Object.keys(defaultSettings)];
keys.forEach((k) => this.values.set(k, defaultSettings[k]));
}

// Special case python path (not in the object)
if (defaultSettings && defaultSettings.pythonPath) {
this.values.set('pythonPath', defaultSettings.pythonPath);
}
}

public get<T>(key: string, defaultValue?: T): T | undefined {
Expand Down