Skip to content

Commit

Permalink
switch to using constant for deprecation msg
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorjboyd committed Oct 9, 2023
1 parent 6ecaa9a commit f9bc755
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
9 changes: 4 additions & 5 deletions src/client/testing/testController/common/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) => {
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/client/testing/testController/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
return createDeferred<void>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
ITestServer,
} from '../common/types';
import {
MESSAGE_ON_TESTING_OUTPUT_MOVE,
createDiscoveryErrorPayload,
createEOTPayload,
createTestingDeferred,
Expand Down Expand Up @@ -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}.`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}.`);
}
Expand Down
7 changes: 0 additions & 7 deletions src/test/testing/common/testingAdapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9bc755

Please sign in to comment.