2
2
3
3
import copy
4
4
import json
5
+ import platform
5
6
import tempfile
6
7
from threading import Event
7
8
@@ -23,7 +24,6 @@ def get_changes(changes_file):
23
24
return json .load (ch_file )
24
25
25
26
26
- @pytest .mark .skip (reason = "Test broke with new compile-based diagnostics" )
27
27
def test_publish_diagnostics_on_open ():
28
28
"""Tests publish diagnostics on open."""
29
29
content_path = DIAGNOSTICS_TEST_ROOT / "diagnostics_test1_contents.txt"
@@ -72,7 +72,14 @@ def _handler(params):
72
72
assert len (symbols ) > 0
73
73
74
74
# wait for a second to receive all notifications
75
- done .wait (1 )
75
+ done .wait (1.1 )
76
+
77
+ # Diagnostics look a little different on Windows.
78
+ filename = (
79
+ as_uri (py_file .fullpath )
80
+ if platform .system () == "Windows"
81
+ else py_file .basename
82
+ )
76
83
77
84
expected = [
78
85
{
@@ -83,17 +90,16 @@ def _handler(params):
83
90
"start" : {"line" : 5 , "character" : 15 },
84
91
"end" : {"line" : 5 , "character" : 16 },
85
92
},
86
- "message" : "SyntaxError: invalid syntax" ,
93
+ "message" : f "SyntaxError: invalid syntax ( { filename } , line 6) " ,
87
94
"severity" : 1 ,
88
- "source" : "jedi " ,
95
+ "source" : "compile " ,
89
96
}
90
97
],
91
98
}
92
99
]
93
100
assert_that (actual , is_ (expected ))
94
101
95
102
96
- @pytest .mark .skip (reason = "Test broke with new compile-based diagnostics" )
97
103
def test_publish_diagnostics_on_change ():
98
104
"""Tests publish diagnostics on change."""
99
105
@@ -175,7 +181,14 @@ def _handler(params):
175
181
assert len (symbols ) > 0
176
182
177
183
# wait for a second to receive all notifications
178
- done .wait (1 )
184
+ done .wait (1.1 )
185
+
186
+ # Diagnostics look a little different on Windows.
187
+ filename = (
188
+ as_uri (py_file .fullpath )
189
+ if platform .system () == "Windows"
190
+ else py_file .basename
191
+ )
179
192
180
193
expected = [
181
194
{
@@ -186,17 +199,16 @@ def _handler(params):
186
199
"start" : {"line" : 5 , "character" : 15 },
187
200
"end" : {"line" : 5 , "character" : 16 },
188
201
},
189
- "message" : "SyntaxError: invalid syntax" ,
202
+ "message" : f "SyntaxError: invalid syntax ( { filename } , line 6) " ,
190
203
"severity" : 1 ,
191
- "source" : "jedi " ,
204
+ "source" : "compile " ,
192
205
}
193
206
],
194
207
}
195
208
]
196
209
assert_that (actual , is_ (expected ))
197
210
198
211
199
- @pytest .mark .skip (reason = "Test broke with new compile-based diagnostics" )
200
212
def test_publish_diagnostics_on_save ():
201
213
"""Tests publish diagnostics on save."""
202
214
@@ -293,7 +305,14 @@ def _handler(params):
293
305
)
294
306
295
307
# wait for a second to receive all notifications
296
- done .wait (1 )
308
+ done .wait (1.1 )
309
+
310
+ # Diagnostics look a little different on Windows.
311
+ filename = (
312
+ as_uri (py_file .fullpath )
313
+ if platform .system () == "Windows"
314
+ else py_file .basename
315
+ )
297
316
298
317
expected = [
299
318
{
@@ -304,9 +323,9 @@ def _handler(params):
304
323
"start" : {"line" : 5 , "character" : 15 },
305
324
"end" : {"line" : 5 , "character" : 16 },
306
325
},
307
- "message" : "SyntaxError: invalid syntax" ,
326
+ "message" : f "SyntaxError: invalid syntax ( { filename } , line 6) " ,
308
327
"severity" : 1 ,
309
- "source" : "jedi " ,
328
+ "source" : "compile " ,
310
329
}
311
330
],
312
331
}
0 commit comments