@@ -43,24 +43,23 @@ def workspace(tmpdir):
4343
4444
4545class 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
4848
4949 def plugin_settings (self , plugin , document_path = None ):
5050 return {}
5151
5252
53- def test_settings ():
54- config = FakeConfig ( )
53+ def test_settings (tmpdir ):
54+ config = Config ( uris . from_fs_path ( str ( tmpdir )), {}, 0 , {} )
5555 settings = plugin .pylsp_settings (config )
5656 assert settings == {"plugins" : {"pylsp_mypy" : {}}}
5757
5858
5959def test_plugin (workspace , last_diagnostics_monkeypatch ):
60- config = FakeConfig ()
6160 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 )
6463
6564 assert len (diags ) == 1
6665 diag = diags [0 ]
@@ -179,7 +178,7 @@ def test_option_overrides(tmpdir, last_diagnostics_monkeypatch, workspace):
179178 assert not sentinel .exists ()
180179
181180 diags = plugin .pylsp_lint (
182- config = FakeConfig (),
181+ config = FakeConfig (uris . to_fs_path ( workspace . root_uri ) ),
183182 workspace = workspace ,
184183 document = Document (DOC_URI , workspace , DOC_TYPE_ERR ),
185184 is_saved = False ,
@@ -208,7 +207,7 @@ def test_option_overrides_dmypy(last_diagnostics_monkeypatch, workspace):
208207 document = Document (DOC_URI , workspace , DOC_TYPE_ERR )
209208
210209 plugin .pylsp_lint (
211- config = FakeConfig (),
210+ config = FakeConfig (uris . to_fs_path ( workspace . root_uri ) ),
212211 workspace = workspace ,
213212 document = document ,
214213 is_saved = False ,
@@ -247,7 +246,7 @@ def test_dmypy_status_file(tmpdir, last_diagnostics_monkeypatch, workspace):
247246 assert not statusFile .exists ()
248247
249248 plugin .pylsp_lint (
250- config = FakeConfig (),
249+ config = FakeConfig (uris . to_fs_path ( workspace . root_uri ) ),
251250 workspace = workspace ,
252251 document = document ,
253252 is_saved = False ,
0 commit comments