forked from VimPlug/jedi
Add any .egg-link paths from VIRTUAL_ENV to sys.path
Adding test_get_sys_path required factoring out `_get_venv_sitepackages`, because `sys.version_info` cannot be mocked apparently.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
from jedi._compatibility import unicode
|
||||
from jedi.parser import Parser, load_grammar
|
||||
from jedi.evaluate import sys_path, Evaluator
|
||||
@@ -15,3 +17,15 @@ def test_paths_from_assignment():
|
||||
|
||||
# Fail for complicated examples.
|
||||
assert paths('sys.path, other = ["a"], 2') == []
|
||||
|
||||
|
||||
def test_get_sys_path(monkeypatch):
|
||||
monkeypatch.setenv('VIRTUAL_ENV', os.path.join(os.path.dirname(__file__),
|
||||
'egg-link', 'venv'))
|
||||
def sitepackages_dir(venv):
|
||||
return os.path.join(venv, 'lib', 'python3.4', 'site-packages')
|
||||
|
||||
monkeypatch.setattr('jedi.evaluate.sys_path._get_venv_sitepackages',
|
||||
sitepackages_dir)
|
||||
|
||||
assert '/path/from/egg-link' in sys_path.get_sys_path()
|
||||
|
||||
Reference in New Issue
Block a user