mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-07 07:40:55 +08:00
Fix some issues with the latest changes
This commit is contained in:
@@ -138,7 +138,7 @@ def venv_path(tmpdir, environment):
|
||||
# ones. Instead, we find the real Python executable by printing the value
|
||||
# of sys.base_prefix or sys.real_prefix if we are in a virtualenv.
|
||||
output = subprocess.check_output([
|
||||
environment._executable, "-c",
|
||||
environment.executable, "-c",
|
||||
"import sys; "
|
||||
"print(sys.real_prefix if hasattr(sys, 'real_prefix') else sys.base_prefix)"
|
||||
])
|
||||
@@ -146,7 +146,7 @@ def venv_path(tmpdir, environment):
|
||||
if os.name == 'nt':
|
||||
executable_path = os.path.join(prefix, 'python')
|
||||
else:
|
||||
executable_name = os.path.basename(environment._executable)
|
||||
executable_name = os.path.basename(environment.executable)
|
||||
executable_path = os.path.join(prefix, 'bin', executable_name)
|
||||
|
||||
subprocess.call([executable_path, '-m', 'venv', dirname])
|
||||
|
||||
@@ -100,14 +100,14 @@ def test_not_existing_virtualenv():
|
||||
"""Should not match the path that was given"""
|
||||
path = '/foo/bar/jedi_baz'
|
||||
with set_environment_variable('VIRTUAL_ENV', path):
|
||||
assert get_default_environment()._executable != path
|
||||
assert get_default_environment().executable != path
|
||||
|
||||
|
||||
def test_working_venv(venv_path):
|
||||
with set_environment_variable('VIRTUAL_ENV', venv_path):
|
||||
assert get_default_environment()._base_path == venv_path
|
||||
assert get_default_environment().path == venv_path
|
||||
|
||||
|
||||
def test_scanning_venvs(venv_path):
|
||||
parent_dir = os.path.dirname(venv_path)
|
||||
assert any(venv._base_path == venv_path for venv in find_virtualenvs([parent_dir]))
|
||||
assert any(venv.path == venv_path for venv in find_virtualenvs([parent_dir]))
|
||||
|
||||
@@ -4,7 +4,7 @@ import sys
|
||||
import shutil
|
||||
|
||||
from jedi.evaluate import sys_path
|
||||
from jedi.api.environment import Environment
|
||||
from jedi.api.environment import create_environment
|
||||
|
||||
|
||||
def test_paths_from_assignment(Script):
|
||||
@@ -29,11 +29,10 @@ def test_paths_from_assignment(Script):
|
||||
def test_venv_and_pths(venv_path):
|
||||
pjoin = os.path.join
|
||||
|
||||
bin_name = 'Scripts' if os.name == 'nt' else 'bin'
|
||||
virtualenv = Environment(venv_path, pjoin(venv_path, bin_name, 'python'))
|
||||
virtualenv = create_environment(venv_path)
|
||||
|
||||
CUR_DIR = os.path.dirname(__file__)
|
||||
site_pkg_path = pjoin(virtualenv._base_path, 'lib')
|
||||
site_pkg_path = pjoin(virtualenv.path, 'lib')
|
||||
if os.name == 'nt':
|
||||
site_pkg_path = pjoin(site_pkg_path, 'site-packages')
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user