diff --git a/experiments.json b/experiments.json index 1c4782442858..a9eb11d02f93 100644 --- a/experiments.json +++ b/experiments.json @@ -29,30 +29,6 @@ "min": 0, "max": 40 }, - { - "name": "DebugAdapterFactory - control", - "salt": "DebugAdapterFactory", - "min": 0, - "max": 0 - }, - { - "name": "DebugAdapterFactory - experiment", - "salt": "DebugAdapterFactory", - "min": 0, - "max": 100 - }, - { - "name": "PtvsdWheels37 - control", - "salt": "DebugAdapterFactory", - "min": 0, - "max": 0 - }, - { - "name": "PtvsdWheels37 - experiment", - "salt": "DebugAdapterFactory", - "min": 0, - "max": 100 - }, { "name": "Reload - control", "salt": "DebugAdapterFactory", @@ -185,5 +161,4 @@ "max": 0, "min": 0 } - ] diff --git a/package.json b/package.json index 7557b9aa865a..53bd2c8bb8c7 100644 --- a/package.json +++ b/package.json @@ -1592,8 +1592,6 @@ "LS - enabled", "AlwaysDisplayTestExplorer - experiment", "ShowExtensionSurveyPrompt - enabled", - "DebugAdapterFactory - experiment", - "PtvsdWheels37 - experiment", "Reload - experiment", "AA_testing - experiment", "WebHostNotebook - experiment", @@ -1617,8 +1615,6 @@ "LS - enabled", "AlwaysDisplayTestExplorer - experiment", "ShowExtensionSurveyPrompt - enabled", - "DebugAdapterFactory - experiment", - "PtvsdWheels37 - experiment", "Reload - experiment", "AA_testing - experiment", "WebHostNotebook - experiment", diff --git a/package.nls.json b/package.nls.json index ff4f684fcaf1..d78ab83685da 100644 --- a/package.nls.json +++ b/package.nls.json @@ -254,7 +254,6 @@ "diagnostics.consoleTypeDiagnostic": "Your launch.json file needs to be updated to change the console type string from \"none\" to \"internalConsole\", otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?", "diagnostics.justMyCodeDiagnostic": "Configuration \"debugStdLib\" in launch.json is no longer supported. It's recommended to replace it with \"justMyCode\", which is the exact opposite of using \"debugStdLib\". Would you like to automatically update your launch.json file to do that?", "diagnostics.yesUpdateLaunch": "Yes, update launch.json", - "diagnostics.processId": "Attaching the debugger to a local process is an experimental feature. It will be available to all users soon.", "diagnostics.invalidTestSettings": "Your settings needs to be updated to change the setting \"python.unitTest.\" to \"python.testing.\", otherwise testing Python code using the extension may not work. Would you like to automatically update your settings now?", "DataScience.interruptKernel": "Interrupt IPython kernel", "DataScience.clearAllOutput": "Clear All Output", diff --git a/package.nls.zh-tw.json b/package.nls.zh-tw.json index 8535d7058238..55962646e530 100644 --- a/package.nls.zh-tw.json +++ b/package.nls.zh-tw.json @@ -92,7 +92,6 @@ "diagnostics.consoleTypeDiagnostic": "Your launch.json file needs to be updated to change the console type string from \"none\" to \"internalConsole\", otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?", "diagnostics.justMyCodeDiagnostic": "Configuration \"debugStdLib\" in launch.json is no longer supported. It's recommended to replace it with \"justMyCode\", which is the exact opposite of using \"debugStdLib\". Would you like to automatically update your launch.json file to do that?", "diagnostics.yesUpdateLaunch": "是,更新 launch.json", - "diagnostics.processId": "Attaching the debugger to a local process is an experimental feature. It will be available to all users soon.", "diagnostics.invalidTestSettings": "Your settings needs to be updated to change the setting \"python.unitTest.\" to \"python.testing.\", otherwise testing Python code using the extension may not work. Would you like to automatically update your settings now?", "Common.canceled": "已取消", "Common.cancel": "取消", diff --git a/src/client/common/experimentGroups.ts b/src/client/common/experimentGroups.ts index 9cb0a8104c44..cea1bad2f337 100644 --- a/src/client/common/experimentGroups.ts +++ b/src/client/common/experimentGroups.ts @@ -13,18 +13,6 @@ export enum ShowExtensionSurveyPrompt { enabled = 'ShowExtensionSurveyPrompt - enabled' } -// Experiment to check whether the extension should use the new VS Code debug adapter API. -export enum DebugAdapterDescriptorFactory { - control = 'DebugAdapterFactory - control', - experiment = 'DebugAdapterFactory - experiment' -} - -// Experiment to check whether the ptvsd launcher should use pre-installed ptvsd wheels for debugging. -export enum DebugAdapterNewPtvsd { - control = 'PtvsdWheels37 - control', - experiment = 'PtvsdWheels37 - experiment' -} - // Experiment to check whether to enable re-load for web apps while debugging. export enum WebAppReload { control = 'Reload - control', diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index 04b952ff57dd..76c900059951 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -68,10 +68,6 @@ export namespace Diagnostics { 'Your settings needs to be updated to change the setting "python.unitTest." to "python.testing.", otherwise testing Python code using the extension may not work. Would you like to automatically update your settings now?' ); export const updateSettings = localize('diagnostics.updateSettings', 'Yes, update settings'); - export const processId = localize( - 'diagnostics.processId', - 'Attaching the debugger to a local process is an experimental feature. It will be available to all users soon.' - ); } export namespace Common { diff --git a/src/client/datascience/jupyter/jupyterDebugger.ts b/src/client/datascience/jupyter/jupyterDebugger.ts index 44a565ba03c9..1fd2cd006f01 100644 --- a/src/client/datascience/jupyter/jupyterDebugger.ts +++ b/src/client/datascience/jupyter/jupyterDebugger.ts @@ -10,10 +10,9 @@ import * as vsls from 'vsls/vscode'; import { concatMultilineStringOutput } from '../../../datascience-ui/common'; import { ServerStatus } from '../../../datascience-ui/interactive-common/mainState'; import { IApplicationShell } from '../../common/application/types'; -import { DebugAdapterNewPtvsd } from '../../common/experimentGroups'; import { traceError, traceInfo, traceWarning } from '../../common/logger'; import { IPlatformService } from '../../common/platform/types'; -import { IConfigurationService, IExperimentsManager, Version } from '../../common/types'; +import { IConfigurationService, Version } from '../../common/types'; import * as localize from '../../common/utils/localize'; import { EXTENSION_ROOT_DIR } from '../../constants'; import { captureTelemetry, sendTelemetryEvent } from '../../telemetry'; @@ -51,22 +50,13 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener { @inject(IJupyterDebugService) @named(Identifiers.MULTIPLEXING_DEBUGSERVICE) private debugService: IJupyterDebugService, - @inject(IPlatformService) private platform: IPlatformService, - @inject(IExperimentsManager) private readonly experimentsManager: IExperimentsManager + @inject(IPlatformService) private platform: IPlatformService ) { - if (this.experimentsManager.inExperiment(DebugAdapterNewPtvsd.experiment)) { - this.debuggerPackage = 'debugpy'; - this.enableDebuggerCode = `import debugpy;debugpy.listen(('localhost', 0))`; - this.waitForDebugClientCode = `import debugpy;debugpy.wait_for_client()`; - this.tracingEnableCode = `from debugpy import trace_this_thread;trace_this_thread(True)`; - this.tracingDisableCode = `from debugpy import trace_this_thread;trace_this_thread(False)`; - } else { - this.debuggerPackage = 'ptvsd'; - this.enableDebuggerCode = `import ptvsd;ptvsd.enable_attach(('localhost', 0))`; - this.waitForDebugClientCode = `import ptvsd;ptvsd.wait_for_attach()`; - this.tracingEnableCode = `from ptvsd import tracing;tracing(True)`; - this.tracingDisableCode = `from ptvsd import tracing;tracing(False)`; - } + this.debuggerPackage = 'debugpy'; + this.enableDebuggerCode = `import debugpy;debugpy.listen(('localhost', 0))`; + this.waitForDebugClientCode = `import debugpy;debugpy.wait_for_client()`; + this.tracingEnableCode = `from debugpy import trace_this_thread;trace_this_thread(True)`; + this.tracingDisableCode = `from debugpy import trace_this_thread;trace_this_thread(False)`; } public startRunByLine(notebook: INotebook, cellHashFileName: string): Promise { diff --git a/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts b/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts index f149e0958dbd..b9aa0d14542b 100644 --- a/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts +++ b/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts @@ -7,11 +7,12 @@ import { inject, injectable } from 'inversify'; import { DebugAdapterTracker, DebugAdapterTrackerFactory, DebugSession, ProviderResult } from 'vscode'; import { DebugProtocol } from 'vscode-debugprotocol'; import { IApplicationShell } from '../../../common/application/types'; -import { DebugAdapterNewPtvsd } from '../../../common/experimentGroups'; -import { IBrowserService, IExperimentsManager } from '../../../common/types'; +import { IBrowserService } from '../../../common/types'; import { Common, OutdatedDebugger } from '../../../common/utils/localize'; import { IPromptShowState } from './types'; +// This situation occurs when user connects to old containers or server where +// the debugger they had installed was ptvsd. We should show a prompt to ask them to update. class OutdatedDebuggerPrompt implements DebugAdapterTracker { constructor( private promptCheck: IPromptShowState, @@ -71,14 +72,10 @@ class OutdatedDebuggerPromptState implements IPromptShowState { export class OutdatedDebuggerPromptFactory implements DebugAdapterTrackerFactory { private readonly promptCheck: OutdatedDebuggerPromptState; constructor( - @inject(IExperimentsManager) private readonly experimentsManager: IExperimentsManager, @inject(IApplicationShell) private readonly appShell: IApplicationShell, @inject(IBrowserService) private browserService: IBrowserService ) { this.promptCheck = new OutdatedDebuggerPromptState(); - if (!this.experimentsManager.inExperiment(DebugAdapterNewPtvsd.experiment)) { - this.promptCheck.setShowPrompt(false); - } } public createDebugAdapterTracker(_session: DebugSession): ProviderResult { return new OutdatedDebuggerPrompt(this.promptCheck, this.appShell, this.browserService); diff --git a/src/client/debugger/extension/configuration/resolvers/attach.ts b/src/client/debugger/extension/configuration/resolvers/attach.ts index bcfdd4734e79..bb8fdf913bed 100644 --- a/src/client/debugger/extension/configuration/resolvers/attach.ts +++ b/src/client/debugger/extension/configuration/resolvers/attach.ts @@ -6,10 +6,8 @@ import { inject, injectable } from 'inversify'; import { CancellationToken, Uri, WorkspaceFolder } from 'vscode'; import { IDocumentManager, IWorkspaceService } from '../../../../common/application/types'; -import { DebugAdapterNewPtvsd } from '../../../../common/experimentGroups'; import { IPlatformService } from '../../../../common/platform/types'; -import { IConfigurationService, IExperimentsManager } from '../../../../common/types'; -import { Diagnostics } from '../../../../common/utils/localize'; +import { IConfigurationService } from '../../../../common/types'; import { AttachRequestArguments, DebugOptions, PathMapping } from '../../../types'; import { BaseConfigurationResolver } from './base'; @@ -19,8 +17,7 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver { - if ( - !this.experiments.inExperiment(DebugAdapterNewPtvsd.experiment) && - debugConfiguration.processId !== undefined - ) { - throw Error(Diagnostics.processId()); - } const workspaceFolder = this.getWorkspaceFolder(folder); await this.provideAttachDefaults(workspaceFolder, debugConfiguration as AttachRequestArguments); diff --git a/src/client/debugger/extension/configuration/resolvers/launchConfigExperiment.ts b/src/client/debugger/extension/configuration/resolvers/launchConfigExperiment.ts index d6416950adf0..0409fd21a9d3 100644 --- a/src/client/debugger/extension/configuration/resolvers/launchConfigExperiment.ts +++ b/src/client/debugger/extension/configuration/resolvers/launchConfigExperiment.ts @@ -4,7 +4,7 @@ 'use strict'; import { inject, injectable } from 'inversify'; -import { DebugAdapterNewPtvsd, WebAppReload } from '../../../../common/experimentGroups'; +import { WebAppReload } from '../../../../common/experimentGroups'; import { traceInfo } from '../../../../common/logger'; import { IExperimentsManager } from '../../../../common/types'; import { sendTelemetryEvent } from '../../../../telemetry'; @@ -17,45 +17,43 @@ export class LaunchDebugConfigurationExperiment implements ILaunchDebugConfigura constructor(@inject(IExperimentsManager) private readonly experimentsManager: IExperimentsManager) {} public modifyConfigurationBasedOnExperiment(debugConfiguration: LaunchRequestArguments): void { - if (this.experimentsManager.inExperiment(DebugAdapterNewPtvsd.experiment)) { - if (this.experimentsManager.inExperiment(WebAppReload.experiment)) { - if (this.isWebAppConfiguration(debugConfiguration)) { - traceInfo( - `Configuration used for Web App Reload experiment (before):\n${JSON.stringify( - debugConfiguration, - undefined, - 4 - )}` - ); + if (this.experimentsManager.inExperiment(WebAppReload.experiment)) { + if (this.isWebAppConfiguration(debugConfiguration)) { + traceInfo( + `Configuration used for Web App Reload experiment (before):\n${JSON.stringify( + debugConfiguration, + undefined, + 4 + )}` + ); - let subProcessModified: boolean = false; - if (!debugConfiguration.subProcess) { - subProcessModified = true; - debugConfiguration.subProcess = true; - } - - let argsModified: boolean = false; - const args = debugConfiguration.args.filter((arg) => arg !== '--noreload' && arg !== '--no-reload'); - if (args.length !== debugConfiguration.args.length) { - argsModified = true; - debugConfiguration.args = args; - } + let subProcessModified: boolean = false; + if (!debugConfiguration.subProcess) { + subProcessModified = true; + debugConfiguration.subProcess = true; + } - traceInfo( - `Configuration used for Web App Reload experiment (after):\n${JSON.stringify( - debugConfiguration, - undefined, - 4 - )}` - ); - sendTelemetryEvent(EventName.PYTHON_WEB_APP_RELOAD, undefined, { - subProcessModified, - argsModified - }); + let argsModified: boolean = false; + const args = debugConfiguration.args.filter((arg) => arg !== '--noreload' && arg !== '--no-reload'); + if (args.length !== debugConfiguration.args.length) { + argsModified = true; + debugConfiguration.args = args; } - } else { - this.experimentsManager.sendTelemetryIfInExperiment(WebAppReload.control); + + traceInfo( + `Configuration used for Web App Reload experiment (after):\n${JSON.stringify( + debugConfiguration, + undefined, + 4 + )}` + ); + sendTelemetryEvent(EventName.PYTHON_WEB_APP_RELOAD, undefined, { + subProcessModified, + argsModified + }); } + } else { + this.experimentsManager.sendTelemetryIfInExperiment(WebAppReload.control); } } diff --git a/src/test/debugger/attach.ptvsd.test.ts b/src/test/debugger/attach.ptvsd.test.ts index 0be2a3801c87..3213dcc65cc2 100644 --- a/src/test/debugger/attach.ptvsd.test.ts +++ b/src/test/debugger/attach.ptvsd.test.ts @@ -13,10 +13,9 @@ import { DebugClient } from 'vscode-debugadapter-testsupport'; import { IDocumentManager, IWorkspaceService } from '../../client/common/application/types'; import { EXTENSION_ROOT_DIR } from '../../client/common/constants'; -import { DebugAdapterNewPtvsd } from '../../client/common/experimentGroups'; import { IS_WINDOWS } from '../../client/common/platform/constants'; import { IPlatformService } from '../../client/common/platform/types'; -import { IConfigurationService, IExperimentsManager } from '../../client/common/types'; +import { IConfigurationService } from '../../client/common/types'; import { MultiStepInputFactory } from '../../client/common/utils/multiStepInput'; import { DebuggerTypeName, PTVSD_PATH } from '../../client/debugger/constants'; import { PythonDebugConfigurationService } from '../../client/debugger/extension/configuration/debugConfigurationService'; @@ -116,16 +115,13 @@ suite('Debugging - Attach Debugger', () => { const workspaceService = TypeMoq.Mock.ofType(); const documentManager = TypeMoq.Mock.ofType(); const configurationService = TypeMoq.Mock.ofType(); - const experiments = TypeMoq.Mock.ofType(); - experiments.setup((e) => e.inExperiment(DebugAdapterNewPtvsd.experiment)).returns(() => true); const launchResolver = TypeMoq.Mock.ofType>(); const attachResolver = new AttachConfigurationResolver( workspaceService.object, documentManager.object, platformService.object, - configurationService.object, - experiments.object + configurationService.object ); const providerFactory = TypeMoq.Mock.ofType().object; const multistepFactory = mock(MultiStepInputFactory); diff --git a/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts b/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts index a924be25a2db..cb7643397552 100644 --- a/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts +++ b/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts @@ -4,32 +4,22 @@ 'use strict'; import * as assert from 'assert'; -import { anyString, anything, instance, mock, spy, verify, when } from 'ts-mockito'; +import { anyString, anything, instance, mock, verify, when } from 'ts-mockito'; import { DebugSession, WorkspaceFolder } from 'vscode'; import { DebugProtocol } from 'vscode-debugprotocol'; -import { ApplicationEnvironment } from '../../../../client/common/application/applicationEnvironment'; import { ApplicationShell } from '../../../../client/common/application/applicationShell'; import { IApplicationShell } from '../../../../client/common/application/types'; import { ConfigurationService } from '../../../../client/common/configuration/service'; -import { CryptoUtils } from '../../../../client/common/crypto'; -import { DebugAdapterNewPtvsd } from '../../../../client/common/experimentGroups'; -import { ExperimentsManager } from '../../../../client/common/experiments'; import { BrowserService } from '../../../../client/common/net/browser'; -import { HttpClient } from '../../../../client/common/net/httpClient'; -import { PersistentStateFactory } from '../../../../client/common/persistentState'; -import { FileSystem } from '../../../../client/common/platform/fileSystem'; import { IBrowserService, IPythonSettings } from '../../../../client/common/types'; import { createDeferred, sleep } from '../../../../client/common/utils/async'; import { Common } from '../../../../client/common/utils/localize'; import { OutdatedDebuggerPromptFactory } from '../../../../client/debugger/extension/adapter/outdatedDebuggerPrompt'; import { clearTelemetryReporter } from '../../../../client/telemetry'; -import { MockOutputChannel } from '../../../mockClasses'; // tslint:disable-next-line: max-func-body-length suite('Debugging - Outdated Debugger Prompt tests.', () => { let promptFactory: OutdatedDebuggerPromptFactory; - let experimentsManager: ExperimentsManager; - let spiedInstance: ExperimentsManager; let appShell: IApplicationShell; let browserService: IBrowserService; @@ -48,36 +38,15 @@ suite('Debugging - Outdated Debugger Prompt tests.', () => { }; setup(() => { - const httpClient = mock(HttpClient); - const crypto = mock(CryptoUtils); - const appEnvironment = mock(ApplicationEnvironment); - const persistentStateFactory = mock(PersistentStateFactory); - const output = mock(MockOutputChannel); const configurationService = mock(ConfigurationService); - const fs = mock(FileSystem); when(configurationService.getSettings(undefined)).thenReturn(({ experiments: { enabled: true } // tslint:disable-next-line: no-any } as any) as IPythonSettings); - experimentsManager = new ExperimentsManager( - instance(persistentStateFactory), - instance(httpClient), - instance(crypto), - instance(appEnvironment), - instance(output), - instance(fs), - instance(configurationService) - ); - spiedInstance = spy(experimentsManager); - - experimentsManager = mock(ExperimentsManager); + appShell = mock(ApplicationShell); browserService = mock(BrowserService); - promptFactory = new OutdatedDebuggerPromptFactory( - experimentsManager, - instance(appShell), - instance(browserService) - ); + promptFactory = new OutdatedDebuggerPromptFactory(instance(appShell), instance(browserService)); }); teardown(() => { @@ -99,8 +68,7 @@ suite('Debugging - Outdated Debugger Prompt tests.', () => { }; } - test('Show prompt when in new debugger experiment and using ptvsd, more info not clicked', async () => { - when(spiedInstance.inExperiment(DebugAdapterNewPtvsd.experiment)).thenReturn(true); + test('Show prompt when attaching to ptvsd, more info is NOT clicked', async () => { when(appShell.showInformationMessage(anything(), anything())).thenReturn(Promise.resolve(undefined)); const session = createSession(); @@ -123,8 +91,7 @@ suite('Debugging - Outdated Debugger Prompt tests.', () => { verify(appShell.showInformationMessage(anything(), anything())).once(); }); - test('Show prompt when in new debugger experiment and using ptvsd, more info clicked', async () => { - when(spiedInstance.inExperiment(DebugAdapterNewPtvsd.experiment)).thenReturn(true); + test('Show prompt when attaching to ptvsd, more info is clicked', async () => { when(appShell.showInformationMessage(anything(), anything())).thenReturn(Promise.resolve(Common.moreInfo())); const deferred = createDeferred(); when(browserService.launch(anything())).thenCall(() => deferred.resolve()); @@ -150,8 +117,7 @@ suite('Debugging - Outdated Debugger Prompt tests.', () => { verify(appShell.showInformationMessage(anything(), anything())).once(); }); - test("Don't show prompt when in new debugger experiment and using debugpy", async () => { - when(spiedInstance.inExperiment(DebugAdapterNewPtvsd.experiment)).thenReturn(true); + test("Don't show prompt attaching to debugpy", async () => { when(appShell.showInformationMessage(anything(), anything())).thenReturn(Promise.resolve(undefined)); const session = createSession(); @@ -189,10 +155,7 @@ suite('Debugging - Outdated Debugger Prompt tests.', () => { }; [someRequest, someEvent, someOutputEvent].forEach((message) => { - test(`Don't show prompt when in new debugger experiment and debugger telemetry event: ${JSON.stringify( - message - )}`, async () => { - when(spiedInstance.inExperiment(DebugAdapterNewPtvsd.experiment)).thenReturn(true); + test(`Don't show prompt when non-telemetry events are seen: ${JSON.stringify(message)}`, async () => { when(appShell.showInformationMessage(anything(), anything())).thenReturn(Promise.resolve(undefined)); const session = createSession(); diff --git a/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts b/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts index a36aaf374a25..474e8bf55601 100644 --- a/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts +++ b/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts @@ -10,10 +10,8 @@ import * as TypeMoq from 'typemoq'; import { DebugConfiguration, DebugConfigurationProvider, TextDocument, TextEditor, Uri, WorkspaceFolder } from 'vscode'; import { IDocumentManager, IWorkspaceService } from '../../../../../client/common/application/types'; import { PYTHON_LANGUAGE } from '../../../../../client/common/constants'; -import { DebugAdapterNewPtvsd } from '../../../../../client/common/experimentGroups'; import { IFileSystem, IPlatformService } from '../../../../../client/common/platform/types'; -import { IConfigurationService, IExperimentsManager } from '../../../../../client/common/types'; -import { Diagnostics } from '../../../../../client/common/utils/localize'; +import { IConfigurationService } from '../../../../../client/common/types'; import { OSType } from '../../../../../client/common/utils/platform'; import { AttachConfigurationResolver } from '../../../../../client/debugger/extension/configuration/resolvers/attach'; import { AttachRequestArguments, DebugOptions } from '../../../../../client/debugger/types'; @@ -46,7 +44,6 @@ getInfoPerOS().forEach(([osName, osType, path]) => { let documentManager: TypeMoq.IMock; let configurationService: TypeMoq.IMock; let workspaceService: TypeMoq.IMock; - let experimentsManager: TypeMoq.IMock; const debugOptionsAvailable = getAvailableOptions(); setup(() => { serviceContainer = TypeMoq.Mock.ofType(); @@ -60,15 +57,11 @@ getInfoPerOS().forEach(([osName, osType, path]) => { serviceContainer.setup((c) => c.get(TypeMoq.It.isValue(IFileSystem))).returns(() => fileSystem.object); setUpOSMocks(osType, platformService); documentManager = TypeMoq.Mock.ofType(); - experimentsManager = TypeMoq.Mock.ofType(); - experimentsManager.setup((e) => e.inExperiment(DebugAdapterNewPtvsd.experiment)).returns(() => true); - debugProvider = new AttachConfigurationResolver( workspaceService.object, documentManager.object, platformService.object, - configurationService.object, - experimentsManager.object + configurationService.object ); }); function createMoqWorkspaceFolder(folderPath: string) { @@ -517,36 +510,5 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(debugConfig).to.have.property('justMyCode', testParams.expectedResult); }); }); - - test("If not in PtvsdWheels experiment and debugConfiguration does not contain 'processId' field, do not throw error", async () => { - const activeFile = 'xyz.py'; - const workspaceFolder = createMoqWorkspaceFolder(__dirname); - setupActiveEditor(activeFile, PYTHON_LANGUAGE); - const defaultWorkspace = path.join('usr', 'desktop'); - setupWorkspaces([defaultWorkspace]); - experimentsManager.reset(); - experimentsManager.setup((e) => e.inExperiment(DebugAdapterNewPtvsd.experiment)).returns(() => false); - - const promise = debugProvider.resolveDebugConfiguration!(workspaceFolder, ({ - request: 'attach' - } as any) as DebugConfiguration); - await expect(promise).to.not.be.rejectedWith(Error); - }); - - test("If not in PtvsdWheels experiment and debugConfiguration contains 'processId' field, throw error", async () => { - const activeFile = 'xyz.py'; - const workspaceFolder = createMoqWorkspaceFolder(__dirname); - setupActiveEditor(activeFile, PYTHON_LANGUAGE); - const defaultWorkspace = path.join('usr', 'desktop'); - setupWorkspaces([defaultWorkspace]); - experimentsManager.reset(); - experimentsManager.setup((e) => e.inExperiment(DebugAdapterNewPtvsd.experiment)).returns(() => false); - - const promise = debugProvider.resolveDebugConfiguration!(workspaceFolder, ({ - request: 'attach', - processId: 1234 - } as any) as DebugConfiguration); - await expect(promise).to.be.rejectedWith(Diagnostics.processId()); - }); }); }); diff --git a/src/test/debugger/extension/configuration/resolvers/launchConfigExperiments.unit.test.ts b/src/test/debugger/extension/configuration/resolvers/launchConfigExperiments.unit.test.ts index 339f3bd68ba1..aa7c9e149abf 100644 --- a/src/test/debugger/extension/configuration/resolvers/launchConfigExperiments.unit.test.ts +++ b/src/test/debugger/extension/configuration/resolvers/launchConfigExperiments.unit.test.ts @@ -10,7 +10,7 @@ import { instance, mock, spy, when } from 'ts-mockito'; import { ApplicationEnvironment } from '../../../../../client/common/application/applicationEnvironment'; import { ConfigurationService } from '../../../../../client/common/configuration/service'; import { CryptoUtils } from '../../../../../client/common/crypto'; -import { DebugAdapterNewPtvsd, WebAppReload } from '../../../../../client/common/experimentGroups'; +import { WebAppReload } from '../../../../../client/common/experimentGroups'; import { ExperimentsManager } from '../../../../../client/common/experiments'; import { HttpClient } from '../../../../../client/common/net/httpClient'; import { PersistentStateFactory } from '../../../../../client/common/persistentState'; @@ -44,7 +44,6 @@ suite('Debugging - Config Resolver Launch Experiments', () => { } class TestConfiguration { - public newDebuggerExperiment: string = ''; public reloadExperiment: string = ''; public subProcess?: boolean; public args: string[] = []; @@ -95,7 +94,6 @@ suite('Debugging - Config Resolver Launch Experiments', () => { clearTelemetryReporter(); }); - const newDebuggerExperiment = ['experiment', 'control']; const reloadExperiment = ['experiment', 'control']; const noReloadSwitches = ['--no-reload', '--noreload']; const subProcessValues = [undefined, false, true]; @@ -103,15 +101,6 @@ suite('Debugging - Config Resolver Launch Experiments', () => { function getExperimentsData(testConfig: TestConfiguration) { return [ - { - name: - testConfig.newDebuggerExperiment === 'experiment' - ? DebugAdapterNewPtvsd.experiment - : DebugAdapterNewPtvsd.control, - salt: 'DebugAdapterDescriptorFactory', - min: 0, - max: 0 - }, { name: testConfig.reloadExperiment === 'experiment' ? WebAppReload.experiment : WebAppReload.control, salt: 'DebugAdapterDescriptorFactory', @@ -123,23 +112,20 @@ suite('Debugging - Config Resolver Launch Experiments', () => { function createTestConfigurations() { const testConfigs: TestConfiguration[] = []; - newDebuggerExperiment.forEach((newDbgExp) => { - reloadExperiment.forEach((reloadExp) => { - subProcessValues.forEach((subProcessValue) => { - noReloadSwitches.forEach((noReloadSwitch) => { - webFramework.forEach((framework) => { - const usingReloadSwitch = ['run', noReloadSwitch, '--other-switch']; - const withoutUsingReloadSwitch = ['run', '--other-switch']; - [usingReloadSwitch, withoutUsingReloadSwitch].forEach((args) => { - testConfigs.push({ - newDebuggerExperiment: newDbgExp, - reloadExperiment: reloadExp, - subProcess: subProcessValue, - args: args, - framework: framework, - withoutReloadArgs: ['run', '--other-switch'], - withReloadArgs: ['run', noReloadSwitch, '--other-switch'] - }); + reloadExperiment.forEach((reloadExp) => { + subProcessValues.forEach((subProcessValue) => { + noReloadSwitches.forEach((noReloadSwitch) => { + webFramework.forEach((framework) => { + const usingReloadSwitch = ['run', noReloadSwitch, '--other-switch']; + const withoutUsingReloadSwitch = ['run', '--other-switch']; + [usingReloadSwitch, withoutUsingReloadSwitch].forEach((args) => { + testConfigs.push({ + reloadExperiment: reloadExp, + subProcess: subProcessValue, + args: args, + framework: framework, + withoutReloadArgs: ['run', '--other-switch'], + withReloadArgs: ['run', noReloadSwitch, '--other-switch'] }); }); }); @@ -153,8 +139,7 @@ suite('Debugging - Config Resolver Launch Experiments', () => { // Figure out if we need to expect modification to the debug config. Debug config should be modified // only if the user is in debug adapter descriptor experiment, new ptvsd experiment, the reload experiment // and finally one of the following web app frameworks (django, flask, pyramid, jinja) - const inExperiment = - testConfig.newDebuggerExperiment === 'experiment' && testConfig.reloadExperiment === 'experiment'; + const inExperiment = testConfig.reloadExperiment === 'experiment'; const knownWebFramework = ['django', 'flask', 'jinja', 'pyramid'].includes(testConfig.framework); // Args should only be modified if they meet the 'modification' conditions above AND they have a reload argument @@ -203,27 +188,22 @@ suite('Debugging - Config Resolver Launch Experiments', () => { const expectedEvents: string[] = []; const expectedProperties: object[] = []; - if (testConfig.newDebuggerExperiment === 'experiment') { + if (testConfig.reloadExperiment === 'experiment') { expectedEvents.push(EventName.PYTHON_EXPERIMENTS); - expectedProperties.push({ expName: DebugAdapterNewPtvsd.experiment }); + expectedProperties.push({ expName: WebAppReload.experiment }); - if (testConfig.reloadExperiment === 'experiment') { - expectedEvents.push(EventName.PYTHON_EXPERIMENTS); - expectedProperties.push({ expName: WebAppReload.experiment }); - - if (['django', 'flask', 'jinja', 'pyramid'].includes(testConfig.framework)) { - expectedEvents.push(EventName.PYTHON_WEB_APP_RELOAD); - expectedProperties.push({ - subProcessModified: `${subProcModified}`, - argsModified: `${argsModified}` - }); - } else { - // Don't add any event - } + if (['django', 'flask', 'jinja', 'pyramid'].includes(testConfig.framework)) { + expectedEvents.push(EventName.PYTHON_WEB_APP_RELOAD); + expectedProperties.push({ + subProcessModified: `${subProcModified}`, + argsModified: `${argsModified}` + }); } else { - expectedEvents.push(EventName.PYTHON_EXPERIMENTS); - expectedProperties.push({ expName: WebAppReload.control }); + // Don't add any event } + } else { + expectedEvents.push(EventName.PYTHON_EXPERIMENTS); + expectedProperties.push({ expName: WebAppReload.control }); } resolverExperiment.modifyConfigurationBasedOnExperiment(config); diff --git a/src/test/debugger/run.test.ts b/src/test/debugger/run.test.ts index 5265e2132829..2e167dc8bd7f 100644 --- a/src/test/debugger/run.test.ts +++ b/src/test/debugger/run.test.ts @@ -8,7 +8,7 @@ import * as path from 'path'; import { DebugClient } from 'vscode-debugadapter-testsupport'; import { noop } from '../../client/common/utils/misc'; -import { DebuggerTypeName, PTVSD_PATH } from '../../client/debugger/constants'; +import { DebuggerTypeName } from '../../client/debugger/constants'; import { DebugOptions, LaunchRequestArguments } from '../../client/debugger/types'; import { PYTHON_PATH, sleep } from '../common'; import { IS_MULTI_ROOT_TEST, TEST_DEBUGGER } from '../initialize'; @@ -51,7 +51,7 @@ suite('Run without Debugging', () => { debugOptions: [DebugOptions.RedirectOutput], pythonPath: PYTHON_PATH, args: [], - env: { PYTHONPATH: PTVSD_PATH }, + env: {}, envFile: '', logToFile: false, type: debuggerType,