22import os
33import sys
44
5- from test .test_utils import MockWorkspace
65import pytest
76
87from pyls import uris , lsp
@@ -278,7 +277,7 @@ def test_multistatement_snippet(config, workspace):
278277 assert completions [0 ]['insertText' ] == 'date(${1:year}, ${2:month}, ${3:day})$0'
279278
280279
281- def test_jedi_completion_extra_paths (config , tmpdir , workspace ):
280+ def test_jedi_completion_extra_paths (tmpdir , workspace ):
282281 # Create a tempfile with some content and pass to extra_paths
283282 temp_doc_content = '''
284283def spam():
@@ -296,42 +295,42 @@ def spam():
296295
297296 # After 'foo.s' without extra paths
298297 com_position = {'line' : 1 , 'character' : 5 }
299- completions = pyls_jedi_completions (config , doc , com_position )
298+ completions = pyls_jedi_completions (doc . _config , doc , com_position )
300299 assert completions is None
301300
302301 # Update config extra paths
303- config . update ({ ' plugins' : {'jedi' : {'extra_paths' : extra_paths }}})
304- doc .update_config (config )
302+ settings = { 'pyls' : { ' plugins' : {'jedi' : {'extra_paths' : extra_paths }}}}
303+ doc .update_config (settings )
305304
306305 # After 'foo.s' with extra paths
307306 com_position = {'line' : 1 , 'character' : 5 }
308- completions = pyls_jedi_completions (config , doc , com_position )
307+ completions = pyls_jedi_completions (doc . _config , doc , com_position )
309308 assert completions [0 ]['label' ] == 'spam()'
310309
311310
312311@pytest .mark .skipif (PY2 or not LINUX or not CI , reason = "tested on linux and python 3 only" )
313- def test_jedi_completion_environment (config ):
312+ def test_jedi_completion_environment (workspace ):
314313 # Content of doc to test completion
315314 doc_content = '''import logh
316315'''
317- doc = Document (DOC_URI , MockWorkspace () , doc_content )
316+ doc = Document (DOC_URI , workspace , doc_content )
318317
319318 # After 'import logh' with default environment
320319 com_position = {'line' : 0 , 'character' : 11 }
321320
322321 assert os .path .isdir ('/tmp/pyenv/' )
323322
324- config . update ({ ' plugins' : {'jedi' : {'environment' : None }}})
325- doc .update_config (config )
326- completions = pyls_jedi_completions (config , doc , com_position )
323+ settings = { 'pyls' : { ' plugins' : {'jedi' : {'environment' : None }}}}
324+ doc .update_config (settings )
325+ completions = pyls_jedi_completions (doc . _config , doc , com_position )
327326 assert completions is None
328327
329328 # Update config extra environment
330329 env_path = '/tmp/pyenv/bin/python'
331- config . update ({ ' plugins' : {'jedi' : {'environment' : env_path }}})
332- doc .update_config (config )
330+ settings = { 'pyls' : { ' plugins' : {'jedi' : {'environment' : env_path }}}}
331+ doc .update_config (settings )
333332
334333 # After 'import logh' with new environment
335- completions = pyls_jedi_completions (config , doc , com_position )
334+ completions = pyls_jedi_completions (doc . _config , doc , com_position )
336335 assert completions [0 ]['label' ] == 'loghub'
337336 assert 'changelog generator' in completions [0 ]['documentation' ].lower ()
0 commit comments