Skip to content

Commit 882117f

Browse files
youben11ccordoba12
authored andcommitted
Fix failing pylint test (#663)
1 parent c3cab77 commit 882117f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

test/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Copyright 2017 Palantir Technologies, Inc.
2+
import sys
23
import pytest
34
from pyls import IS_WIN
45

6+
IS_PY3 = sys.version_info.major == 3
7+
58
unix_only = pytest.mark.skipif(IS_WIN, reason="Unix only")
69
windows_only = pytest.mark.skipif(not IS_WIN, reason="Windows only")
10+
py3_only = pytest.mark.skipif(not IS_PY3, reason="Python3 only")
11+
py2_only = pytest.mark.skipif(IS_PY3, reason="Python2 only")

test/plugins/test_pylint_lint.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import tempfile
55

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

5152

52-
def test_syntax_error_pylint(config):
53+
@py3_only
54+
def test_syntax_error_pylint_py3(config):
55+
with temp_document(DOC_SYNTAX_ERR) as doc:
56+
diag = pylint_lint.pyls_lint(config, doc, True)[0]
57+
58+
assert diag['message'].startswith('[syntax-error] invalid syntax')
59+
# Pylint doesn't give column numbers for invalid syntax.
60+
assert diag['range']['start'] == {'line': 0, 'character': 12}
61+
assert diag['severity'] == lsp.DiagnosticSeverity.Error
62+
63+
64+
@py2_only
65+
def test_syntax_error_pylint_py2(config):
5366
with temp_document(DOC_SYNTAX_ERR) as doc:
5467
diag = pylint_lint.pyls_lint(config, doc, True)[0]
5568

0 commit comments

Comments
 (0)