Skip to content

Commit

Permalink
Fix debugger attach tests (#2656)
Browse files Browse the repository at this point in the history
For #2655
  • Loading branch information
DonJayamanne authored Sep 21, 2018
1 parent 8b2a9b0 commit 4a18c8b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions news/2 Fixes/2655.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix debug adapter `Attach` test.
7 changes: 3 additions & 4 deletions src/test/debugger/attach.ptvsd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ import { DebuggerTypeName, PTVSD_PATH } from '../../client/debugger/Common/const
import { AttachRequestArguments, DebugOptions } from '../../client/debugger/Common/Contracts';
import { IServiceContainer } from '../../client/ioc/types';
import { PYTHON_PATH, sleep } from '../common';
import { initialize, IS_MULTI_ROOT_TEST, TEST_DEBUGGER } from '../initialize';
import { IS_MULTI_ROOT_TEST, TEST_DEBUGGER } from '../initialize';
import { continueDebugging, createDebugAdapter } from './utils';

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

suite('Attach Debugger', () => {
let debugClient: DebugClient;
let proc: ChildProcess;
suiteSetup(initialize);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import sys
import time
time.sleep(2)
sys.stdout.write('this is stdout')
sys.stdout.flush()
sys.stderr.write('this is stderr')
sys.stderr.flush()
# Give the debugger some time to add a breakpoint.
time.sleep(5)
for i in range(1):
time.sleep(0.5)
pass

print('this is print')
def main():
sys.stdout.write('this is stdout')
sys.stdout.flush()
sys.stderr.write('this is stderr')
sys.stderr.flush()
# Give the debugger some time to add a breakpoint.
time.sleep(5)
for i in range(1):
time.sleep(0.5)
pass

print('this is print')

main()

0 comments on commit 4a18c8b

Please sign in to comment.