Skip to content

Commit

Permalink
test starts with (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Apr 19, 2017
1 parent 950059d commit 1f250df
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 36 deletions.
14 changes: 7 additions & 7 deletions src/client/unittests/nosetest/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ export function runTest(rootDirectory: string, tests: Tests, args: string[], tes
const nosetestlauncherargs = [rootDirectory, 'my_secret', pythonSettings.unitTest.debugPort.toString(), 'nose'];
let outputChannelShown = false;
execPythonFile(pythonSettings.pythonPath, [testLauncherFile].concat(nosetestlauncherargs).concat(noseTestArgs.concat(testPaths)), rootDirectory, true, (data: string) => {
if (data === 'READY' + os.EOL) {
if (data.startsWith('READY' + os.EOL)) {
// debug socket server has started
launchDef.resolve();
data = data.substring(('READY' + os.EOL).length);
}
else {
if (!outputChannelShown) {
outputChannelShown = true;
outChannel.show();
}
outChannel.append(data);

if (!outputChannelShown) {
outputChannelShown = true;
outChannel.show();
}
outChannel.append(data);
}, token).catch(reason => {
if (!def.rejected && !def.resolved) {
def.reject(reason);
Expand Down
14 changes: 7 additions & 7 deletions src/client/unittests/pytest/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ export function runTest(rootDirectory: string, tests: Tests, args: string[], tes
const pytestlauncherargs = [rootDirectory, 'my_secret', pythonSettings.unitTest.debugPort.toString(), 'pytest'];
let outputChannelShown = false;
execPythonFile(pythonSettings.pythonPath, [testLauncherFile].concat(pytestlauncherargs).concat(testArgs), rootDirectory, true, (data: string) => {
if (data === 'READY' + os.EOL) {
if (data.startsWith('READY' + os.EOL)) {
// debug socket server has started
launchDef.resolve();
data = data.substring(('READY' + os.EOL).length);
}
else {
if (!outputChannelShown){
outputChannelShown = true;
outChannel.show();
}
outChannel.append(data);

if (!outputChannelShown) {
outputChannelShown = true;
outChannel.show();
}
outChannel.append(data);
}, token).catch(reason => {
if (!def.rejected && !def.resolved) {
def.reject(reason);
Expand Down
46 changes: 24 additions & 22 deletions src/client/unittests/unittest/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ export function runTest(testManager: BaseTestManager, rootDirectory: string, tes

// start the debug adapter only once we have started the debug process
execPythonFile(settings.pythonPath, [testLauncherFile].concat(testArgs), rootDirectory, true, (data: string) => {
if (data === 'READY' + os.EOL) {
if (data.startsWith('READY' + os.EOL)) {
// debug socket server has started
launchDef.resolve();
data = data.substring(('READY' + os.EOL).length);
}
else {
if (!outputChannelShown) {
outputChannelShown = true;
outChannel.show();
}
outChannel.append(data);

if (!outputChannelShown) {
outputChannelShown = true;
outChannel.show();
}
outChannel.append(data);
}, token).catch(reason => {
if (!def.rejected && !def.resolved) {
def.reject(reason);
Expand All @@ -127,22 +127,24 @@ export function runTest(testManager: BaseTestManager, rootDirectory: string, tes
}
});

launchDef.promise.then(() => {
return vscode.commands.executeCommand('vscode.startDebug', {
"name": "Debug Unit Test",
"type": "python",
"request": "attach",
"localRoot": rootDirectory,
"remoteRoot": rootDirectory,
"port": settings.unitTest.debugPort,
"secret": "my_secret",
"host": "localhost"
launchDef.promise
.then(() => {
return vscode.commands.executeCommand('vscode.startDebug', {
"name": "Debug Unit Test",
"type": "python",
"request": "attach",
"localRoot": rootDirectory,
"remoteRoot": rootDirectory,
"port": settings.unitTest.debugPort,
"secret": "my_secret",
"host": "localhost"
});
})
.catch(reason => {
if (!def.rejected && !def.resolved) {
def.reject(reason);
}
});
}).catch(reason => {
if (!def.rejected && !def.resolved) {
def.reject(reason);
}
});

return def.promise;
}
Expand Down

0 comments on commit 1f250df

Please sign in to comment.