File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Copyright 2017 Palantir Technologies, Inc.
2
+ import sys
2
3
import pytest
3
4
from pyls import IS_WIN
4
5
6
+ IS_PY3 = sys .version_info .major == 3
7
+
5
8
unix_only = pytest .mark .skipif (IS_WIN , reason = "Unix only" )
6
9
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" )
Original file line number Diff line number Diff line change 3
3
import os
4
4
import tempfile
5
5
6
+ from test import py2_only , py3_only
6
7
from pyls import lsp , uris
7
8
from pyls .workspace import Document
8
9
from pyls .plugins import pylint_lint
@@ -49,7 +50,19 @@ def test_pylint(config):
49
50
assert unused_import ['severity' ] == lsp .DiagnosticSeverity .Warning
50
51
51
52
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 ):
53
66
with temp_document (DOC_SYNTAX_ERR ) as doc :
54
67
diag = pylint_lint .pyls_lint (config , doc , True )[0 ]
55
68
You can’t perform that action at this time.
0 commit comments