4
4
5
5
import contextlib
6
6
import os
7
- import sys
8
7
import tempfile
9
8
10
9
from pylsp import lsp , uris
@@ -70,10 +69,8 @@ def test_syntax_error_pylint(config, workspace):
70
69
with temp_document (DOC_SYNTAX_ERR , workspace ) as doc :
71
70
diag = pylint_lint .pylsp_lint (config , doc , True )[0 ]
72
71
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' )
77
74
# Pylint doesn't give column numbers for invalid syntax.
78
75
assert diag ['range' ]['start' ] == {'line' : 0 , 'character' : 12 }
79
76
assert diag ['severity' ] == lsp .DiagnosticSeverity .Error
@@ -83,7 +80,7 @@ def test_syntax_error_pylint(config, workspace):
83
80
config .plugin_settings ('pylint' )['executable' ] = 'pylint'
84
81
diag = pylint_lint .pylsp_lint (config , doc , True )[0 ]
85
82
86
- assert diag ['message' ].count ("expected ':'" ) or diag ['message' ].startswith ('invalid syntax' )
83
+ assert diag ['message' ].count ("expected ':'" ) or diag ['message' ].count ('invalid syntax' )
87
84
# Pylint doesn't give column numbers for invalid syntax.
88
85
assert diag ['range' ]['start' ] == {'line' : 0 , 'character' : 12 }
89
86
assert diag ['severity' ] == lsp .DiagnosticSeverity .Error
0 commit comments