Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/3 Code Health/1048.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable unit testing of stdout and stderr redirection for the experimental debugger.
22 changes: 12 additions & 10 deletions src/test/debugger/misc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const THREAD_TIMEOUT = 10000;
await sleep(1000);
});
function buildLauncArgs(pythonFile: string, stopOnEntry: boolean = false): LaunchRequestArguments {
return {
const options: LaunchRequestArguments = {
program: path.join(debugFilesPath, pythonFile),
cwd: debugFilesPath,
stopOnEntry,
Expand All @@ -63,6 +63,13 @@ const THREAD_TIMEOUT = 10000;
logToFile: false,
type: debuggerType
};

// Custom experimental debugger options (filled in by DebugConfigurationProvider).
if (debuggerType === 'pythonExperimental') {
(options as any).redirectOutput = true;
}

return options;
}

test('Should run program to the end', async () => {
Expand All @@ -84,23 +91,18 @@ const THREAD_TIMEOUT = 10000;
debugClient.waitForEvent('stopped')
]);
});
test('test stderr output', async function () {
if (debuggerType !== 'python') {
return this.skip();
}
test('test stderr output for Python', async () => {
const output = debuggerType === 'python' ? 'stdout' : 'stderr';
await Promise.all([
debugClient.configurationSequence(),
debugClient.launch(buildLauncArgs('stdErrOutput.py', false)),
debugClient.waitForEvent('initialized'),
//TODO: ptvsd does not differentiate.
debugClient.assertOutput('stdout', 'error output'),
debugClient.assertOutput(output, 'error output'),
debugClient.waitForEvent('terminated')
]);
});
test('Test stdout output', async function () {
if (debuggerType !== 'python') {
return this.skip();
}
test('Test stdout output', async () => {
await Promise.all([
debugClient.configurationSequence(),
debugClient.launch(buildLauncArgs('stdOutOutput.py', false)),
Expand Down