Skip to content

Commit 901f8e4

Browse files
committed
remove all usage of Python Test Log
1 parent 18efcd6 commit 901f8e4

File tree

8 files changed

+7
-54
lines changed

8 files changed

+7
-54
lines changed

python_files/vscode_pytest/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def pytest_internalerror(excrepr, excinfo): # noqa: ARG001
121121
excinfo -- the exception information of type ExceptionInfo.
122122
"""
123123
# call.excinfo.exconly() returns the exception as a string.
124-
ERRORS.append(excinfo.exconly() + "\n Check Python Test Logs for more details.")
124+
ERRORS.append(excinfo.exconly() + "\n Check Python Logs for more details.")
125125

126126

127127
def pytest_exception_interact(node, call, report):
@@ -139,9 +139,9 @@ def pytest_exception_interact(node, call, report):
139139
if call.excinfo and call.excinfo.typename != "AssertionError":
140140
if report.outcome == "skipped" and "SkipTest" in str(call):
141141
return
142-
ERRORS.append(call.excinfo.exconly() + "\n Check Python Test Logs for more details.")
142+
ERRORS.append(call.excinfo.exconly() + "\n Check Python Logs for more details.")
143143
else:
144-
ERRORS.append(report.longreprtext + "\n Check Python Test Logs for more details.")
144+
ERRORS.append(report.longreprtext + "\n Check Python Logs for more details.")
145145
else:
146146
# If during execution, send this data that the given node failed.
147147
report_value = "error"
@@ -204,7 +204,7 @@ def pytest_keyboard_interrupt(excinfo):
204204
excinfo -- the exception information of type ExceptionInfo.
205205
"""
206206
# The function execonly() returns the exception as a string.
207-
ERRORS.append(excinfo.exconly() + "\n Check Python Test Logs for more details.")
207+
ERRORS.append(excinfo.exconly() + "\n Check Python Logs for more details.")
208208

209209

210210
class TestOutcome(Dict):

src/client/common/utils/localize.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ export namespace InterpreterQuickPickList {
257257
export namespace OutputChannelNames {
258258
export const languageServer = l10n.t('Python Language Server');
259259
export const python = l10n.t('Python');
260-
export const pythonTest = l10n.t('Python Test Log');
261260
}
262261

263262
export namespace Linters {

src/client/extensionInit.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
'use strict';
55

66
import { Container } from 'inversify';
7-
import { Disposable, l10n, Memento, window } from 'vscode';
7+
import { Disposable, Memento, window } from 'vscode';
88
import { registerTypes as platformRegisterTypes } from './common/platform/serviceRegistry';
99
import { registerTypes as processRegisterTypes } from './common/process/serviceRegistry';
1010
import { registerTypes as commonRegisterTypes } from './common/serviceRegistry';
@@ -15,7 +15,6 @@ import {
1515
IExtensionContext,
1616
IMemento,
1717
ILogOutputChannel,
18-
ITestOutputChannel,
1918
WORKSPACE_MEMENTO,
2019
} from './common/types';
2120
import { registerTypes as variableRegisterTypes } from './common/variables/serviceRegistry';
@@ -28,7 +27,6 @@ import * as pythonEnvironments from './pythonEnvironments';
2827
import { IDiscoveryAPI } from './pythonEnvironments/base/locator';
2928
import { registerLogger } from './logging';
3029
import { OutputChannelLogger } from './logging/outputChannelLogger';
31-
import { isTrusted, isVirtualWorkspace } from './common/vscodeApis/workspaceApis';
3230

3331
// The code in this module should do nothing more complex than register
3432
// objects to DI and simple init (e.g. no side effects). That implies
@@ -56,14 +54,7 @@ export function initializeGlobals(
5654
disposables.push(standardOutputChannel);
5755
disposables.push(registerLogger(new OutputChannelLogger(standardOutputChannel)));
5856

59-
const unitTestOutChannel = window.createOutputChannel(OutputChannelNames.pythonTest);
60-
disposables.push(unitTestOutChannel);
61-
if (isVirtualWorkspace() || !isTrusted()) {
62-
unitTestOutChannel.appendLine(l10n.t('Unit tests are not supported in this environment.'));
63-
}
64-
6557
serviceManager.addSingletonInstance<ILogOutputChannel>(ILogOutputChannel, standardOutputChannel);
66-
serviceManager.addSingletonInstance<ITestOutputChannel>(ITestOutputChannel, unitTestOutChannel);
6758

6859
return {
6960
context,

src/client/testing/testController/common/utils.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ export function fixLogLinesNoTrailing(content: string): string {
2323
const lines = content.split(/\r?\n/g);
2424
return `${lines.join('\r\n')}`;
2525
}
26-
27-
export const MESSAGE_ON_TESTING_OUTPUT_MOVE =
28-
'Starting now, all test run output will be sent to the Test Result panel,' +
29-
' while test discovery output will be sent to the "Python" output channel instead of the "Python Test Log" channel.' +
30-
' The "Python Test Log" channel will be deprecated within the next month.' +
31-
' See https://github.com/microsoft/vscode-python/wiki/New-Method-for-Output-Handling-in-Python-Testing for details.';
32-
3326
export function createTestingDeferred(): Deferred<void> {
3427
return createDeferred<void>();
3528
}

src/client/testing/testController/pytest/pytestDiscoveryAdapter.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { EXTENSION_ROOT_DIR } from '../../../constants';
1515
import { traceError, traceInfo, traceVerbose, traceWarn } from '../../../logging';
1616
import { DiscoveredTestPayload, ITestDiscoveryAdapter, ITestResultResolver } from '../common/types';
1717
import {
18-
MESSAGE_ON_TESTING_OUTPUT_MOVE,
1918
createDiscoveryErrorPayload,
2019
createTestingDeferred,
2120
fixLogLinesNoTrailing,
@@ -138,15 +137,12 @@ export class PytestTestDiscoveryAdapter implements ITestDiscoveryAdapter {
138137
proc.stdout.on('data', (data) => {
139138
const out = fixLogLinesNoTrailing(data.toString());
140139
traceInfo(out);
141-
this.outputChannel?.append(out);
142140
});
143141
proc.stderr.on('data', (data) => {
144142
const out = fixLogLinesNoTrailing(data.toString());
145143
traceError(out);
146-
this.outputChannel?.append(out);
147144
});
148145
proc.onExit((code, signal) => {
149-
this.outputChannel?.append(MESSAGE_ON_TESTING_OUTPUT_MOVE);
150146
if (code !== 0) {
151147
traceError(
152148
`Subprocess exited unsuccessfully with exit code ${code} and signal ${signal} on workspace ${uri.fsPath}`,
@@ -205,15 +201,12 @@ export class PytestTestDiscoveryAdapter implements ITestDiscoveryAdapter {
205201
result?.proc?.stdout?.on('data', (data) => {
206202
const out = fixLogLinesNoTrailing(data.toString());
207203
traceInfo(out);
208-
spawnOptions?.outputChannel?.append(`${out}`);
209204
});
210205
result?.proc?.stderr?.on('data', (data) => {
211206
const out = fixLogLinesNoTrailing(data.toString());
212207
traceError(out);
213-
spawnOptions?.outputChannel?.append(`${out}`);
214208
});
215209
result?.proc?.on('exit', (code, signal) => {
216-
this.outputChannel?.append(MESSAGE_ON_TESTING_OUTPUT_MOVE);
217210
if (code !== 0) {
218211
traceError(
219212
`Subprocess exited unsuccessfully with exit code ${code} and signal ${signal} on workspace ${uri.fsPath}.`,

src/client/testing/testController/pytest/pytestExecutionAdapter.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,12 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
194194
proc.stdout.on('data', (data) => {
195195
const out = utils.fixLogLinesNoTrailing(data.toString());
196196
runInstance?.appendOutput(out);
197-
this.outputChannel?.append(out);
198197
});
199198
proc.stderr.on('data', (data) => {
200199
const out = utils.fixLogLinesNoTrailing(data.toString());
201200
runInstance?.appendOutput(out);
202-
this.outputChannel?.append(out);
203201
});
204202
proc.onExit((code, signal) => {
205-
this.outputChannel?.append(utils.MESSAGE_ON_TESTING_OUTPUT_MOVE);
206203
if (code !== 0) {
207204
traceError(
208205
`Subprocess exited unsuccessfully with exit code ${code} and signal ${signal} on workspace ${uri.fsPath}`,
@@ -244,15 +241,12 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
244241
result?.proc?.stdout?.on('data', (data) => {
245242
const out = utils.fixLogLinesNoTrailing(data.toString());
246243
runInstance?.appendOutput(out);
247-
this.outputChannel?.append(out);
248244
});
249245
result?.proc?.stderr?.on('data', (data) => {
250246
const out = utils.fixLogLinesNoTrailing(data.toString());
251247
runInstance?.appendOutput(out);
252-
this.outputChannel?.append(out);
253248
});
254249
result?.proc?.on('exit', (code, signal) => {
255-
this.outputChannel?.append(utils.MESSAGE_ON_TESTING_OUTPUT_MOVE);
256250
if (code !== 0) {
257251
traceError(
258252
`Subprocess exited unsuccessfully with exit code ${code} and signal ${signal} on workspace ${uri.fsPath}`,

src/client/testing/testController/unittest/testDiscoveryAdapter.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ import {
2222
IPythonExecutionFactory,
2323
SpawnOptions,
2424
} from '../../../common/process/types';
25-
import {
26-
MESSAGE_ON_TESTING_OUTPUT_MOVE,
27-
createDiscoveryErrorPayload,
28-
fixLogLinesNoTrailing,
29-
startDiscoveryNamedPipe,
30-
} from '../common/utils';
25+
import { createDiscoveryErrorPayload, fixLogLinesNoTrailing, startDiscoveryNamedPipe } from '../common/utils';
3126
import { traceError, traceInfo, traceLog, traceVerbose } from '../../../logging';
3227
import { getEnvironment, runInBackground, useEnvExtension } from '../../../envExt/api.internal';
3328

@@ -128,15 +123,12 @@ export class UnittestTestDiscoveryAdapter implements ITestDiscoveryAdapter {
128123
proc.stdout.on('data', (data) => {
129124
const out = fixLogLinesNoTrailing(data.toString());
130125
traceInfo(out);
131-
this.outputChannel?.append(out);
132126
});
133127
proc.stderr.on('data', (data) => {
134128
const out = fixLogLinesNoTrailing(data.toString());
135129
traceError(out);
136-
this.outputChannel?.append(out);
137130
});
138131
proc.onExit((code, signal) => {
139-
this.outputChannel?.append(MESSAGE_ON_TESTING_OUTPUT_MOVE);
140132
if (code !== 0) {
141133
traceError(
142134
`Subprocess exited unsuccessfully with exit code ${code} and signal ${signal} on workspace ${uri.fsPath}`,
@@ -191,18 +183,15 @@ export class UnittestTestDiscoveryAdapter implements ITestDiscoveryAdapter {
191183
// TODO: after a release, remove run output from the "Python Test Log" channel and send it to the "Test Result" channel instead.
192184
result?.proc?.stdout?.on('data', (data) => {
193185
const out = fixLogLinesNoTrailing(data.toString());
194-
spawnOptions?.outputChannel?.append(`${out}`);
195186
traceInfo(out);
196187
});
197188
result?.proc?.stderr?.on('data', (data) => {
198189
const out = fixLogLinesNoTrailing(data.toString());
199-
spawnOptions?.outputChannel?.append(`${out}`);
200190
traceError(out);
201191
});
202192

203193
result?.proc?.on('exit', (code, signal) => {
204194
// if the child has testIds then this is a run request
205-
spawnOptions?.outputChannel?.append(MESSAGE_ON_TESTING_OUTPUT_MOVE);
206195

207196
if (code !== 0) {
208197
// This occurs when we are running discovery

src/client/testing/testController/unittest/testExecutionAdapter.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
TestExecutionCommand,
1616
} from '../common/types';
1717
import { traceError, traceInfo, traceLog, traceVerbose } from '../../../logging';
18-
import { MESSAGE_ON_TESTING_OUTPUT_MOVE, fixLogLinesNoTrailing } from '../common/utils';
18+
import { fixLogLinesNoTrailing } from '../common/utils';
1919
import { EnvironmentVariables, IEnvironmentVariablesProvider } from '../../../common/variables/types';
2020
import {
2121
ExecutionFactoryCreateWithEnvironmentOptions,
@@ -205,15 +205,12 @@ export class UnittestTestExecutionAdapter implements ITestExecutionAdapter {
205205
proc.stdout.on('data', (data) => {
206206
const out = utils.fixLogLinesNoTrailing(data.toString());
207207
runInstance?.appendOutput(out);
208-
this.outputChannel?.append(out);
209208
});
210209
proc.stderr.on('data', (data) => {
211210
const out = utils.fixLogLinesNoTrailing(data.toString());
212211
runInstance?.appendOutput(out);
213-
this.outputChannel?.append(out);
214212
});
215213
proc.onExit((code, signal) => {
216-
this.outputChannel?.append(utils.MESSAGE_ON_TESTING_OUTPUT_MOVE);
217214
if (code !== 0) {
218215
traceError(
219216
`Subprocess exited unsuccessfully with exit code ${code} and signal ${signal} on workspace ${uri.fsPath}`,
@@ -255,17 +252,14 @@ export class UnittestTestExecutionAdapter implements ITestExecutionAdapter {
255252
result?.proc?.stdout?.on('data', (data) => {
256253
const out = fixLogLinesNoTrailing(data.toString());
257254
runInstance?.appendOutput(`${out}`);
258-
spawnOptions?.outputChannel?.append(out);
259255
});
260256
result?.proc?.stderr?.on('data', (data) => {
261257
const out = fixLogLinesNoTrailing(data.toString());
262258
runInstance?.appendOutput(`${out}`);
263-
spawnOptions?.outputChannel?.append(out);
264259
});
265260

266261
result?.proc?.on('exit', (code, signal) => {
267262
// if the child has testIds then this is a run request
268-
spawnOptions?.outputChannel?.append(MESSAGE_ON_TESTING_OUTPUT_MOVE);
269263
if (code !== 0 && testIds) {
270264
// This occurs when we are running the test and there is an error which occurs.
271265

0 commit comments

Comments
 (0)