From f9bc7551478c0a862e7547e88ba5213bbc266f0b Mon Sep 17 00:00:00 2001 From: eleanorjboyd Date: Mon, 9 Oct 2023 14:51:18 -0700 Subject: [PATCH] switch to using constant for deprecation msg --- src/client/testing/testController/common/server.ts | 9 ++++----- src/client/testing/testController/common/utils.ts | 5 +++++ .../testController/pytest/pytestDiscoveryAdapter.ts | 8 ++------ .../testController/pytest/pytestExecutionAdapter.ts | 6 +----- src/test/testing/common/testingAdapter.test.ts | 7 ------- 5 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/client/testing/testController/common/server.ts b/src/client/testing/testController/common/server.ts index e7d418c9e28c..e496860526e4 100644 --- a/src/client/testing/testController/common/server.ts +++ b/src/client/testing/testController/common/server.ts @@ -17,6 +17,7 @@ import { DataReceivedEvent, ITestServer, TestCommandOptions } from './types'; import { ITestDebugLauncher, LaunchOptions } from '../../common/types'; import { UNITTEST_PROVIDER } from '../../common/constants'; import { + MESSAGE_ON_TESTING_OUTPUT_MOVE, createDiscoveryErrorPayload, createEOTPayload, createExecutionErrorPayload, @@ -251,10 +252,12 @@ export class PythonTestServer implements ITestServer, Disposable { result?.proc?.stdout?.on('data', (data) => { const out = fixLogLinesNoTrailing(data.toString()); spawnOptions?.outputChannel?.append(`${out}`); + traceInfo(out); }); result?.proc?.stderr?.on('data', (data) => { const out = fixLogLinesNoTrailing(data.toString()); spawnOptions?.outputChannel?.append(`${out}`); + traceError(out); }); } else { result?.proc?.stdout?.on('data', (data) => { @@ -271,11 +274,7 @@ export class PythonTestServer implements ITestServer, Disposable { result?.proc?.on('exit', (code, signal) => { // if the child has testIds then this is a run request - spawnOptions?.outputChannel?.append( - 'Starting now, all test run output will be sent to the Test Result panel' + - ' and test discovery output will be sent to the "Python" output channel instead of the "Python Test Log" channel.' + - ' The "Python Test Log" channel will be deprecated within the next month. See ___ for details.', - ); + spawnOptions?.outputChannel?.append(MESSAGE_ON_TESTING_OUTPUT_MOVE); if (isDiscovery) { if (code !== 0) { // This occurs when we are running discovery diff --git a/src/client/testing/testController/common/utils.ts b/src/client/testing/testController/common/utils.ts index 0846387fc01d..4502708063e9 100644 --- a/src/client/testing/testController/common/utils.ts +++ b/src/client/testing/testController/common/utils.ts @@ -47,6 +47,11 @@ export interface ExtractOutput { export const JSONRPC_UUID_HEADER = 'Request-uuid'; export const JSONRPC_CONTENT_LENGTH_HEADER = 'Content-Length'; export const JSONRPC_CONTENT_TYPE_HEADER = 'Content-Type'; +export const MESSAGE_ON_TESTING_OUTPUT_MOVE = + 'Starting now, all test run output will be sent to the Test Result panel' + + ' and test discovery output will be sent to the "Python" output channel instead of the "Python Test Log" channel.' + + ' The "Python Test Log" channel will be deprecated within the next month.' + + 'See https://github.com/microsoft/vscode-python/wiki/New-Method-for-Output-Handling-in-Python-Testing for details.'; export function createTestingDeferred(): Deferred { return createDeferred(); diff --git a/src/client/testing/testController/pytest/pytestDiscoveryAdapter.ts b/src/client/testing/testController/pytest/pytestDiscoveryAdapter.ts index d1e472d88382..92bd9f04834e 100644 --- a/src/client/testing/testController/pytest/pytestDiscoveryAdapter.ts +++ b/src/client/testing/testController/pytest/pytestDiscoveryAdapter.ts @@ -19,6 +19,7 @@ import { ITestServer, } from '../common/types'; import { + MESSAGE_ON_TESTING_OUTPUT_MOVE, createDiscoveryErrorPayload, createEOTPayload, createTestingDeferred, @@ -113,12 +114,7 @@ export class PytestTestDiscoveryAdapter implements ITestDiscoveryAdapter { spawnOptions?.outputChannel?.append(`${out}`); }); result?.proc?.on('exit', (code, signal) => { - // Collect all discovery output and log it at process finish to avoid dividing it between log lines. - this.outputChannel?.append( - 'Starting now, all test run output will be sent to the Test Result panel' + - ' and test discovery output will be sent to the "Python" output channel instead of the "Python Test Log" channel.' + - ' The "Python Test Log" channel will be deprecated within the next month. See ___ for details.', - ); + this.outputChannel?.append(MESSAGE_ON_TESTING_OUTPUT_MOVE); if (code !== 0) { traceError(`Subprocess exited unsuccessfully with exit code ${code} and signal ${signal}.`); } diff --git a/src/client/testing/testController/pytest/pytestExecutionAdapter.ts b/src/client/testing/testController/pytest/pytestExecutionAdapter.ts index db427262d330..5c04aabab845 100644 --- a/src/client/testing/testController/pytest/pytestExecutionAdapter.ts +++ b/src/client/testing/testController/pytest/pytestExecutionAdapter.ts @@ -202,11 +202,7 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter { this.outputChannel?.append(out); }); result?.proc?.on('exit', (code, signal) => { - this.outputChannel?.append( - 'Starting now, all test run output will be sent to the Test Result panel' + - ' and test discovery output will be sent to the "Python" output channel instead of the "Python Test Log" channel.' + - ' The "Python Test Log" channel will be deprecated within the next month. See ___ for details.', - ); + this.outputChannel?.append(utils.MESSAGE_ON_TESTING_OUTPUT_MOVE); if (code !== 0 && testIds) { traceError(`Subprocess exited unsuccessfully with exit code ${code} and signal ${signal}.`); } diff --git a/src/test/testing/common/testingAdapter.test.ts b/src/test/testing/common/testingAdapter.test.ts index 5cc1696386ae..519a60e3f0f7 100644 --- a/src/test/testing/common/testingAdapter.test.ts +++ b/src/test/testing/common/testingAdapter.test.ts @@ -126,13 +126,6 @@ suite('End to End Tests: test adapters', () => { resultResolver, envVarsService, ); - // // run unittest discovery - // const discoveryAdapter = new UnittestTestDiscoveryAdapter( - // pythonTestServer, - // configService, - // testOutputChannel.object, - // resultResolver, - // ); await discoveryAdapter.discoverTests(workspaceUri).finally(() => { // verification after discovery is complete