diff --git a/pyls/workspace.py b/pyls/workspace.py index 3cce8575..edb9528f 100644 --- a/pyls/workspace.py +++ b/pyls/workspace.py @@ -3,7 +3,6 @@ import logging import os import re -import sys import imp import pkgutil @@ -268,11 +267,8 @@ def sys_path(self): # Copy our extra sys path path = list(self._extra_sys_path) - # Check to see if we're in a virtualenv - if 'VIRTUAL_ENV' in os.environ: - log.info("Using virtualenv %s", os.environ['VIRTUAL_ENV']) - path.extend(jedi.evaluate.sys_path.get_venv_path(os.environ['VIRTUAL_ENV'])) - else: - path.extend(sys.path) + # TODO(gatesn): #339 - make better use of jedi environments, they seem pretty powerful + environment = jedi.api.environment.get_default_environment() + path.extend(environment.get_sys_path()) return path diff --git a/setup.py b/setup.py index ad994a5e..111a7045 100755 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ 'configparser; python_version<"3.0"', 'future>=0.14.0', 'futures; python_version<"3.2"', - 'jedi>=0.10,<0.12', + 'jedi>=0.12', 'pluggy' ], diff --git a/test/test_document.py b/test/test_document.py index 34905415..4fd4ea2f 100644 --- a/test/test_document.py +++ b/test/test_document.py @@ -1,5 +1,4 @@ # Copyright 2017 Palantir Technologies, Inc. -import sys from test.fixtures import DOC_URI, DOC from pyls.workspace import Document @@ -42,14 +41,6 @@ def test_word_at_position(doc): assert doc.word_at_position({'line': 4, 'character': 0}) == '' -def test_document_sys_path(doc): - """Test the document's sys path is updated.""" - assert 'foo' not in doc.sys_path() - sys.path.append('foo') - # Check that the new sys path is included in the doc's sys path - assert 'foo' in doc.sys_path() - - def test_document_empty_edit(): doc = Document('file:///uri', u'') doc.apply_change({