Skip to content

Commit

Permalink
Fix failing pylint test (#663)
Browse files Browse the repository at this point in the history
  • Loading branch information
youben11 authored and ccordoba12 committed Sep 30, 2019
1 parent c3cab77 commit 882117f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Copyright 2017 Palantir Technologies, Inc.
import sys
import pytest
from pyls import IS_WIN

IS_PY3 = sys.version_info.major == 3

unix_only = pytest.mark.skipif(IS_WIN, reason="Unix only")
windows_only = pytest.mark.skipif(not IS_WIN, reason="Windows only")
py3_only = pytest.mark.skipif(not IS_PY3, reason="Python3 only")
py2_only = pytest.mark.skipif(IS_PY3, reason="Python2 only")
15 changes: 14 additions & 1 deletion test/plugins/test_pylint_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import tempfile

from test import py2_only, py3_only
from pyls import lsp, uris
from pyls.workspace import Document
from pyls.plugins import pylint_lint
Expand Down Expand Up @@ -49,7 +50,19 @@ def test_pylint(config):
assert unused_import['severity'] == lsp.DiagnosticSeverity.Warning


def test_syntax_error_pylint(config):
@py3_only
def test_syntax_error_pylint_py3(config):
with temp_document(DOC_SYNTAX_ERR) as doc:
diag = pylint_lint.pyls_lint(config, doc, True)[0]

assert diag['message'].startswith('[syntax-error] invalid syntax')
# Pylint doesn't give column numbers for invalid syntax.
assert diag['range']['start'] == {'line': 0, 'character': 12}
assert diag['severity'] == lsp.DiagnosticSeverity.Error


@py2_only
def test_syntax_error_pylint_py2(config):
with temp_document(DOC_SYNTAX_ERR) as doc:
diag = pylint_lint.pyls_lint(config, doc, True)[0]

Expand Down

0 comments on commit 882117f

Please sign in to comment.