From c3264282b6f3bd266c00ee8aa854fe3a762c226b Mon Sep 17 00:00:00 2001 From: Paula Date: Mon, 15 Jul 2024 12:57:01 -0700 Subject: [PATCH] Fix debug arg error (#23814) Set justMyCode only in the python debugger, not in the python extension. Closed: https://github.com/microsoft/vscode-python-debugger/issues/335 --- .../configuration/resolvers/attach.ts | 7 -- .../configuration/resolvers/launch.ts | 7 -- src/client/debugger/types.ts | 1 - src/client/testing/common/debugLauncher.ts | 2 - .../resolvers/attach.unit.test.ts | 69 ------------------- .../resolvers/launch.unit.test.ts | 69 +------------------ .../testing/common/debugLauncher.unit.test.ts | 9 --- 7 files changed, 1 insertion(+), 163 deletions(-) diff --git a/src/client/debugger/extension/configuration/resolvers/attach.ts b/src/client/debugger/extension/configuration/resolvers/attach.ts index bdc72680d861f..6e5ca501463ea 100644 --- a/src/client/debugger/extension/configuration/resolvers/attach.ts +++ b/src/client/debugger/extension/configuration/resolvers/attach.ts @@ -43,17 +43,10 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver { expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.have.property('debugOptions').to.be.deep.equal(expectedDebugOptions); }); - - const testsForJustMyCode = [ - { - justMyCode: false, - debugStdLib: true, - expectedResult: false, - }, - { - justMyCode: false, - debugStdLib: false, - expectedResult: false, - }, - { - justMyCode: false, - debugStdLib: undefined, - expectedResult: false, - }, - { - justMyCode: true, - debugStdLib: false, - expectedResult: true, - }, - { - justMyCode: true, - debugStdLib: true, - expectedResult: true, - }, - { - justMyCode: true, - debugStdLib: undefined, - expectedResult: true, - }, - { - justMyCode: undefined, - debugStdLib: false, - expectedResult: true, - }, - { - justMyCode: undefined, - debugStdLib: true, - expectedResult: false, - }, - { - justMyCode: undefined, - debugStdLib: undefined, - expectedResult: true, - }, - ]; - test('Ensure justMyCode property is correctly derived from debugStdLib', async () => { - const activeFile = 'xyz.py'; - const workspaceFolder = createMoqWorkspaceFolder(__dirname); - setupActiveEditor(activeFile, PYTHON_LANGUAGE); - const defaultWorkspace = path.join('usr', 'desktop'); - setupWorkspaces([defaultWorkspace]); - - const debugOptions = debugOptionsAvailable - .slice() - .concat(DebugOptions.Jinja, DebugOptions.Sudo) as DebugOptions[]; - - testsForJustMyCode.forEach(async (testParams) => { - const debugConfig = await resolveDebugConfiguration(workspaceFolder, { - ...attach, - debugOptions, - justMyCode: testParams.justMyCode, - debugStdLib: testParams.debugStdLib, - }); - expect(debugConfig).to.have.property('justMyCode', testParams.expectedResult); - }); - }); }); }); diff --git a/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts b/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts index 59f61f81cd856..f312c99b1cbca 100644 --- a/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts +++ b/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts @@ -768,80 +768,13 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(debugConfig).to.have.property('redirectOutput', true); expect(debugConfig).to.have.property('justMyCode', false); expect(debugConfig).to.have.property('debugOptions'); - const expectedOptions = [ - DebugOptions.DebugStdLib, - DebugOptions.ShowReturnValue, - DebugOptions.RedirectOutput, - ]; + const expectedOptions = [DebugOptions.ShowReturnValue, DebugOptions.RedirectOutput]; if (osType === platform.OSType.Windows) { expectedOptions.push(DebugOptions.FixFilePathCase); } expect((debugConfig as DebugConfiguration).debugOptions).to.be.deep.equal(expectedOptions); }); - const testsForJustMyCode = [ - { - justMyCode: false, - debugStdLib: true, - expectedResult: false, - }, - { - justMyCode: false, - debugStdLib: false, - expectedResult: false, - }, - { - justMyCode: false, - debugStdLib: undefined, - expectedResult: false, - }, - { - justMyCode: true, - debugStdLib: false, - expectedResult: true, - }, - { - justMyCode: true, - debugStdLib: true, - expectedResult: true, - }, - { - justMyCode: true, - debugStdLib: undefined, - expectedResult: true, - }, - { - justMyCode: undefined, - debugStdLib: false, - expectedResult: true, - }, - { - justMyCode: undefined, - debugStdLib: true, - expectedResult: false, - }, - { - justMyCode: undefined, - debugStdLib: undefined, - expectedResult: true, - }, - ]; - test('Ensure justMyCode property is correctly derived from debugStdLib', async () => { - const pythonPath = `PythonPath_${new Date().toString()}`; - const workspaceFolder = createMoqWorkspaceFolder(__dirname); - const pythonFile = 'xyz.py'; - setupIoc(pythonPath); - setupActiveEditor(pythonFile, PYTHON_LANGUAGE); - testsForJustMyCode.forEach(async (testParams) => { - const debugConfig = await resolveDebugConfiguration(workspaceFolder, { - ...launch, - debugStdLib: testParams.debugStdLib, - justMyCode: testParams.justMyCode, - }); - expect(debugConfig).to.have.property('justMyCode', testParams.expectedResult); - }); - }); - const testsForRedirectOutput = [ { console: 'internalConsole', diff --git a/src/test/testing/common/debugLauncher.unit.test.ts b/src/test/testing/common/debugLauncher.unit.test.ts index ef3e678c13f7f..31ba761eb9461 100644 --- a/src/test/testing/common/debugLauncher.unit.test.ts +++ b/src/test/testing/common/debugLauncher.unit.test.ts @@ -234,13 +234,6 @@ suite('Unit Tests - Debug Launcher', () => { } expected.workspaceFolder = workspaceFolders[0].uri.fsPath; expected.debugOptions = []; - if (expected.justMyCode === undefined) { - // Populate justMyCode using debugStdLib - expected.justMyCode = !expected.debugStdLib; - } - if (!expected.justMyCode) { - expected.debugOptions.push(DebugOptions.DebugStdLib); - } if (expected.stopOnEntry) { expected.debugOptions.push(DebugOptions.StopOnEntry); } @@ -379,7 +372,6 @@ suite('Unit Tests - Debug Launcher', () => { envFile: 'some/dir/.env', redirectOutput: false, debugStdLib: true, - justMyCode: false, // added by LaunchConfigurationResolver: internalConsoleOptions: 'neverOpen', subProcess: true, @@ -399,7 +391,6 @@ suite('Unit Tests - Debug Launcher', () => { envFile: expected.envFile, redirectOutput: expected.redirectOutput, debugStdLib: expected.debugStdLib, - justMyCode: undefined, }, ]);