Skip to content
Merged
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
24 changes: 14 additions & 10 deletions src/test/debugger/misc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const debugFilesPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'py
const DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'debugger', 'Main.js');
const MAX_SIGNED_INT32 = Math.pow(2, 31) - 1;
const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'debugger', 'mainV2.js');
const THREAD_TIMEOUT = 10000;

[DEBUG_ADAPTER, EXPERIMENTAL_DEBUG_ADAPTER].forEach(testAdapterFilePath => {
const debugAdapterFileName = path.basename(testAdapterFilePath);
Expand Down Expand Up @@ -119,7 +120,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
if (debuggerType !== 'python') {
return this.skip();
}
const threadIdPromise = debugClient.waitForEvent('thread');
const threadIdPromise = debugClient.waitForEvent('thread', THREAD_TIMEOUT);

await Promise.all([
debugClient.configurationSequence(),
Expand All @@ -138,7 +139,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
if (debuggerType !== 'python') {
return this.skip();
}
const threadIdPromise = debugClient.waitForEvent('thread');
const threadIdPromise = debugClient.waitForEvent('thread', THREAD_TIMEOUT);

await Promise.all([
debugClient.configurationSequence(),
Expand All @@ -165,7 +166,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
}
const launchArgs = buildLauncArgs('sample2.py', false);
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 5 };
const processPromise = debugClient.waitForEvent('process') as Promise<DebugProtocol.ProcessEvent>;
const processPromise = debugClient.waitForEvent('process', THREAD_TIMEOUT) as Promise<DebugProtocol.ProcessEvent>;
await debugClient.hitBreakpoint(launchArgs, breakpointLocation);
const processInfo = await processPromise;
const processId = processInfo.body.systemProcessId;
Expand All @@ -178,7 +179,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
expect(isProcessRunning(processId)).to.be.equal(false, 'Python (debugee) Process is still alive');
});
test('Test conditional breakpoints', async () => {
const threadIdPromise = debugClient.waitForEvent('thread');
const threadIdPromise = debugClient.waitForEvent('thread', THREAD_TIMEOUT);

await Promise.all([
debugClient.configurationSequence(),
Expand Down Expand Up @@ -209,7 +210,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
expect(vari.value).to.be.equal('3');
});
test('Test variables', async () => {
const threadIdPromise = debugClient.waitForEvent('thread');
const threadIdPromise = debugClient.waitForEvent('thread', THREAD_TIMEOUT);
await Promise.all([
debugClient.configurationSequence(),
debugClient.launch(buildLauncArgs('sample2.py', false)),
Expand Down Expand Up @@ -279,7 +280,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
expect(response.body.value).to.be.equal('1234');
});
test('Test evaluating expressions', async () => {
const threadIdPromise = debugClient.waitForEvent('thread');
const threadIdPromise = debugClient.waitForEvent('thread', THREAD_TIMEOUT);

await Promise.all([
debugClient.configurationSequence(),
Expand All @@ -305,7 +306,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
expect(response.body.result).to.be.equal('6', 'expression value is incorrect');
});
test('Test stepover', async () => {
const threadIdPromise = debugClient.waitForEvent('thread');
const threadIdPromise = debugClient.waitForEvent('thread', THREAD_TIMEOUT);

await Promise.all([
debugClient.configurationSequence(),
Expand Down Expand Up @@ -337,7 +338,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
await debugClient.assertStoppedLocation('step', printLocation);
});
test('Test stepin and stepout', async () => {
const threadIdPromise = debugClient.waitForEvent('thread');
const threadIdPromise = debugClient.waitForEvent('thread', THREAD_TIMEOUT);

await Promise.all([
debugClient.configurationSequence(),
Expand Down Expand Up @@ -376,14 +377,16 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
await debugClient.assertStoppedLocation('step', printLocation);
});
test('Test pausing', async function () {
if (debuggerType !== 'python') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore this check.
Currently pausing does not work with the old debugger,
With the new debugger, it will not work again as PTVSD is not available on CI server.

// TODO: re-enable for new debugger once it's running on CI
if (debuggerType !== 'pythonExperimental' || IS_CI_SERVER) {
return this.skip();
}

await Promise.all([
debugClient.configurationSequence(),
debugClient.launch(buildLauncArgs('forever.py', false)),
debugClient.waitForEvent('initialized')
debugClient.waitForEvent('initialized'),
debugClient.waitForEvent('process', THREAD_TIMEOUT)
]);

await sleep(3);
Expand All @@ -399,6 +402,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
if (debuggerType !== 'python') {
return this.skip();
}

await Promise.all([
debugClient.configurationSequence(),
debugClient.launch(buildLauncArgs('sample3WithEx.py', false)),
Expand Down