Skip to content

Commit 4a18c8b

Browse files
authored
Fix debugger attach tests (#2656)
For #2655
1 parent 8b2a9b0 commit 4a18c8b

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

news/2 Fixes/2655.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix debug adapter `Attach` test.

src/test/debugger/attach.ptvsd.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,16 @@ import { DebuggerTypeName, PTVSD_PATH } from '../../client/debugger/Common/const
2020
import { AttachRequestArguments, DebugOptions } from '../../client/debugger/Common/Contracts';
2121
import { IServiceContainer } from '../../client/ioc/types';
2222
import { PYTHON_PATH, sleep } from '../common';
23-
import { initialize, IS_MULTI_ROOT_TEST, TEST_DEBUGGER } from '../initialize';
23+
import { IS_MULTI_ROOT_TEST, TEST_DEBUGGER } from '../initialize';
2424
import { continueDebugging, createDebugAdapter } from './utils';
2525

2626
const fileToDebug = path.join(EXTENSION_ROOT_DIR, 'src', 'testMultiRootWkspc', 'workspace5', 'remoteDebugger-start-with-ptvsd.py');
2727

2828
suite('Attach Debugger', () => {
2929
let debugClient: DebugClient;
3030
let proc: ChildProcess;
31-
suiteSetup(initialize);
3231

33-
setup(async function () {
32+
setup(async function() {
3433
if (!IS_MULTI_ROOT_TEST || !TEST_DEBUGGER) {
3534
this.skip();
3635
}
@@ -58,7 +57,7 @@ suite('Attach Debugger', () => {
5857
// Set the path for PTVSD to be picked up.
5958
// tslint:disable-next-line:no-string-literal
6059
env['PYTHONPATH'] = PTVSD_PATH;
61-
const pythonArgs = ['-m', 'ptvsd', '--server', '--port', `${port}`, '--file', fileToDebug.fileToCommandArgument()];
60+
const pythonArgs = ['-m', 'ptvsd', '--server', '--wait', '--port', `${port}`, '--file', fileToDebug.fileToCommandArgument()];
6261
proc = spawn(PYTHON_PATH, pythonArgs, { env: env, cwd: path.dirname(fileToDebug) });
6362
await sleep(3000);
6463

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import sys
22
import time
3-
time.sleep(2)
4-
sys.stdout.write('this is stdout')
5-
sys.stdout.flush()
6-
sys.stderr.write('this is stderr')
7-
sys.stderr.flush()
8-
# Give the debugger some time to add a breakpoint.
9-
time.sleep(5)
10-
for i in range(1):
11-
time.sleep(0.5)
12-
pass
133

14-
print('this is print')
4+
def main():
5+
sys.stdout.write('this is stdout')
6+
sys.stdout.flush()
7+
sys.stderr.write('this is stderr')
8+
sys.stderr.flush()
9+
# Give the debugger some time to add a breakpoint.
10+
time.sleep(5)
11+
for i in range(1):
12+
time.sleep(0.5)
13+
pass
14+
15+
print('this is print')
16+
17+
main()

0 commit comments

Comments
 (0)