From d22cf844d3de76586e7e00d764728e99a88112ed Mon Sep 17 00:00:00 2001 From: eleanorjboyd Date: Fri, 2 Jun 2023 11:31:12 -0700 Subject: [PATCH] resolve debug session when session is canceled --- src/client/testing/testController/common/server.ts | 4 +++- .../testing/testController/pytest/pytestExecutionAdapter.ts | 6 ++++-- .../testing/testController/unittest/testExecutionAdapter.ts | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/client/testing/testController/common/server.ts b/src/client/testing/testController/common/server.ts index 62c14d451fc2..5a09bdc1c62d 100644 --- a/src/client/testing/testController/common/server.ts +++ b/src/client/testing/testController/common/server.ts @@ -158,7 +158,9 @@ export class PythonTestServer implements ITestServer, Disposable { testProvider: UNITTEST_PROVIDER, }; traceInfo(`Running DEBUG unittest with arguments: ${args}\r\n`); - await this.debugLauncher!.launchDebugger(launchOptions); + await this.debugLauncher!.launchDebugger(launchOptions).then(() => { + traceInfo('Debugging has finished.'); + }); } else { if (isRun) { // This means it is running the test diff --git a/src/client/testing/testController/pytest/pytestExecutionAdapter.ts b/src/client/testing/testController/pytest/pytestExecutionAdapter.ts index 413d18497613..cfc937eebeea 100644 --- a/src/client/testing/testController/pytest/pytestExecutionAdapter.ts +++ b/src/client/testing/testController/pytest/pytestExecutionAdapter.ts @@ -171,7 +171,9 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter { pytestRunTestIdsPort, }; traceInfo(`Running DEBUG pytest with arguments: ${testArgs.join(' ')}\r\n`); - await debugLauncher!.launchDebugger(launchOptions); + await debugLauncher!.launchDebugger(launchOptions).then(() => { + traceInfo('Debugging has finished.'); + }); } else { // combine path to run script with run args const scriptPath = path.join(fullPluginPath, 'vscode_pytest', 'run_pytest_script.py'); @@ -187,7 +189,7 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter { traceError(`Error while running tests: ${testIds}\r\n${ex}\r\n\r\n`); return Promise.reject(ex); } - + deferred.resolve(); return deferred.promise; } } diff --git a/src/client/testing/testController/unittest/testExecutionAdapter.ts b/src/client/testing/testController/unittest/testExecutionAdapter.ts index b39e0cd29560..b8a6d0ffbc7e 100644 --- a/src/client/testing/testController/unittest/testExecutionAdapter.ts +++ b/src/client/testing/testController/unittest/testExecutionAdapter.ts @@ -63,7 +63,8 @@ export class UnittestTestExecutionAdapter implements ITestExecutionAdapter { // Send test command to server. // Server fire onDataReceived event once it gets response. - this.testServer.sendCommand(options); + await this.testServer.sendCommand(options); + deferred.resolve(); return deferred.promise; }