Skip to content

Commit e071a65

Browse files
committed
more possibilites of error message due to pylint and Python version combinations
1 parent 594bf8a commit e071a65

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/plugins/test_pylint_lint.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import contextlib
66
import os
7-
import sys
87
import tempfile
98

109
from pylsp import lsp, uris
@@ -70,10 +69,8 @@ def test_syntax_error_pylint(config, workspace):
7069
with temp_document(DOC_SYNTAX_ERR, workspace) as doc:
7170
diag = pylint_lint.pylsp_lint(config, doc, True)[0]
7271

73-
if sys.version_info[:2] >= (3, 10):
74-
assert diag['message'].count("[syntax-error] expected ':'")
75-
else:
76-
assert diag['message'].startswith('[syntax-error] invalid syntax')
72+
assert diag['message'].startswith("[syntax-error]")
73+
assert diag['message'].count("expected ':'") or diag['message'].count('invalid syntax')
7774
# Pylint doesn't give column numbers for invalid syntax.
7875
assert diag['range']['start'] == {'line': 0, 'character': 12}
7976
assert diag['severity'] == lsp.DiagnosticSeverity.Error
@@ -83,7 +80,7 @@ def test_syntax_error_pylint(config, workspace):
8380
config.plugin_settings('pylint')['executable'] = 'pylint'
8481
diag = pylint_lint.pylsp_lint(config, doc, True)[0]
8582

86-
assert diag['message'].count("expected ':'") or diag['message'].startswith('invalid syntax')
83+
assert diag['message'].count("expected ':'") or diag['message'].count('invalid syntax')
8784
# Pylint doesn't give column numbers for invalid syntax.
8885
assert diag['range']['start'] == {'line': 0, 'character': 12}
8986
assert diag['severity'] == lsp.DiagnosticSeverity.Error

0 commit comments

Comments
 (0)