@@ -43,24 +43,23 @@ def workspace(tmpdir):
43
43
44
44
45
45
class FakeConfig (object ):
46
- def __init__ (self ):
47
- self ._root_path = "C://" if os . name == "nt" else "/"
46
+ def __init__ (self , path ):
47
+ self ._root_path = path
48
48
49
49
def plugin_settings (self , plugin , document_path = None ):
50
50
return {}
51
51
52
52
53
- def test_settings ():
54
- config = FakeConfig ( )
53
+ def test_settings (tmpdir ):
54
+ config = Config ( uris . from_fs_path ( str ( tmpdir )), {}, 0 , {} )
55
55
settings = plugin .pylsp_settings (config )
56
56
assert settings == {"plugins" : {"pylsp_mypy" : {}}}
57
57
58
58
59
59
def test_plugin (workspace , last_diagnostics_monkeypatch ):
60
- config = FakeConfig ()
61
60
doc = Document (DOC_URI , workspace , DOC_TYPE_ERR )
62
- plugin .pylsp_settings (config )
63
- diags = plugin .pylsp_lint (config , workspace , doc , is_saved = False )
61
+ plugin .pylsp_settings (workspace . _config )
62
+ diags = plugin .pylsp_lint (workspace . _config , workspace , doc , is_saved = False )
64
63
65
64
assert len (diags ) == 1
66
65
diag = diags [0 ]
@@ -179,7 +178,7 @@ def test_option_overrides(tmpdir, last_diagnostics_monkeypatch, workspace):
179
178
assert not sentinel .exists ()
180
179
181
180
diags = plugin .pylsp_lint (
182
- config = FakeConfig (),
181
+ config = FakeConfig (uris . to_fs_path ( workspace . root_uri ) ),
183
182
workspace = workspace ,
184
183
document = Document (DOC_URI , workspace , DOC_TYPE_ERR ),
185
184
is_saved = False ,
@@ -208,7 +207,7 @@ def test_option_overrides_dmypy(last_diagnostics_monkeypatch, workspace):
208
207
document = Document (DOC_URI , workspace , DOC_TYPE_ERR )
209
208
210
209
plugin .pylsp_lint (
211
- config = FakeConfig (),
210
+ config = FakeConfig (uris . to_fs_path ( workspace . root_uri ) ),
212
211
workspace = workspace ,
213
212
document = document ,
214
213
is_saved = False ,
@@ -247,7 +246,7 @@ def test_dmypy_status_file(tmpdir, last_diagnostics_monkeypatch, workspace):
247
246
assert not statusFile .exists ()
248
247
249
248
plugin .pylsp_lint (
250
- config = FakeConfig (),
249
+ config = FakeConfig (uris . to_fs_path ( workspace . root_uri ) ),
251
250
workspace = workspace ,
252
251
document = document ,
253
252
is_saved = False ,
0 commit comments