|
3 | 3 | import os |
4 | 4 | import tempfile |
5 | 5 |
|
6 | | -from test import py2_only, py3_only |
| 6 | +from test import py2_only, py3_only, IS_PY3 |
7 | 7 | from pyls import lsp, uris |
8 | 8 | from pyls.workspace import Document |
9 | 9 | from pyls.plugins import pylint_lint |
@@ -49,15 +49,19 @@ def test_pylint(config, workspace): |
49 | 49 | assert unused_import['range']['start'] == {'line': 0, 'character': 0} |
50 | 50 | assert unused_import['severity'] == lsp.DiagnosticSeverity.Warning |
51 | 51 |
|
52 | | - # test running pylint in stdin |
53 | | - config.plugin_settings('pylint')['executable'] = 'pylint' |
54 | | - diags = pylint_lint.pyls_lint(config, doc, True) |
| 52 | + if IS_PY3: |
| 53 | + # test running pylint in stdin |
| 54 | + config.plugin_settings('pylint')['executable'] = 'pylint' |
| 55 | + diags = pylint_lint.pyls_lint(config, doc, True) |
55 | 56 |
|
56 | | - msg = 'Unused import sys (unused-import)' |
57 | | - unused_import = [d for d in diags if d['message'] == msg][0] |
| 57 | + msg = 'Unused import sys (unused-import)' |
| 58 | + unused_import = [d for d in diags if d['message'] == msg][0] |
58 | 59 |
|
59 | | - assert unused_import['range']['start'] == {'line': 0, 'character': 0} |
60 | | - assert unused_import['severity'] == lsp.DiagnosticSeverity.Warning |
| 60 | + assert unused_import['range']['start'] == { |
| 61 | + 'line': 0, |
| 62 | + 'character': 0, |
| 63 | + } |
| 64 | + assert unused_import['severity'] == lsp.DiagnosticSeverity.Warning |
61 | 65 |
|
62 | 66 |
|
63 | 67 | @py3_only |
@@ -90,14 +94,6 @@ def test_syntax_error_pylint_py2(config, workspace): |
90 | 94 | assert diag['range']['start'] == {'line': 0, 'character': 0} |
91 | 95 | assert diag['severity'] == lsp.DiagnosticSeverity.Error |
92 | 96 |
|
93 | | - # test running pylint in stdin |
94 | | - config.plugin_settings('pylint')['executable'] = 'pylint' |
95 | | - |
96 | | - assert diag['message'].startswith('invalid syntax') |
97 | | - # Pylint doesn't give column numbers for invalid syntax. |
98 | | - assert diag['range']['start'] == {'line': 0, 'character': 0} |
99 | | - assert diag['severity'] == lsp.DiagnosticSeverity.Error |
100 | | - |
101 | 97 |
|
102 | 98 | def test_lint_free_pylint(config, workspace): |
103 | 99 | # Can't use temp_document because it might give us a file that doesn't |
|
0 commit comments