Skip to content

Commit 0be6c64

Browse files
committed
handle number of linter messages
1 parent 41ea03e commit 0be6c64

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/test/extension.lint.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,14 @@ suite('Linting', () => {
205205
function testLinterMessages(linter: baseLinter.BaseLinter, outputChannel: MockOutputChannel, pythonFile: string, pythonFileLines: string[], messagesToBeReceived: baseLinter.ILintMessage[]): Promise<any> {
206206
return linter.runLinter(pythonFile, pythonFileLines).then(messages => {
207207
// Different versions of python return different errors,
208-
// Here we have errors for version 2.7
209-
assert.notEqual(messages.length, 0, 'No errors in linter, Output - ' + outputChannel.output);
208+
if (messagesToBeReceived.length === 0) {
209+
assert.equal(messages.length, 0, 'No errors in linter, Output - ' + outputChannel.output);
210+
}
211+
else {
212+
// Pylint for Python Version 2.7 could return 80 linter messages, where as in 3.5 it might only return 1
213+
// Looks like pylint stops linting as soon as it comes across any ERRORS
214+
assert.notEqual(messages.length, 0, 'No errors in linter, Output - ' + outputChannel.output);
215+
}
210216
messagesToBeReceived.forEach(msg => {
211217
let similarMessages = messages.filter(m => m.code === msg.code && m.column === msg.column &&
212218
m.line === msg.line && m.message === msg.message && m.severity === msg.severity);

0 commit comments

Comments
 (0)