mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Find Python environments on Windows using the registry
This commit is contained in:
@@ -6,8 +6,8 @@ import pytest
|
||||
|
||||
import jedi
|
||||
from jedi._compatibility import py_version
|
||||
from jedi.api.environment import Environment, get_default_environment, \
|
||||
InvalidPythonEnvironment, find_python_environments
|
||||
from jedi.api.environment import get_default_environment, \
|
||||
get_python_environment, InvalidPythonEnvironment, find_python_environments
|
||||
|
||||
|
||||
def test_sys_path():
|
||||
@@ -24,24 +24,21 @@ def test_find_python_environments():
|
||||
assert parser_version[:2] == env.version_info[:2]
|
||||
|
||||
|
||||
# Cannot deduce the environment from Python executable name on Windows.
|
||||
@pytest.mark.skipif("os.name == 'nt'")
|
||||
@pytest.mark.parametrize(
|
||||
'version',
|
||||
['2.7', '3.3', '3.4', '3.5', '3.6', '3.7']
|
||||
)
|
||||
def test_versions(version):
|
||||
executable = 'python' + version
|
||||
try:
|
||||
env = Environment('some path', executable)
|
||||
env = get_python_environment('python' + version)
|
||||
except InvalidPythonEnvironment:
|
||||
if int(version.replace('.', '')) == py_version:
|
||||
# At least the current version has to work
|
||||
raise
|
||||
return
|
||||
pytest.skip()
|
||||
|
||||
sys_path = env.get_sys_path()
|
||||
assert any(executable in p for p in sys_path)
|
||||
assert version == str(env.version_info[0]) + '.' + str(env.version_info[1])
|
||||
assert env.get_sys_path()
|
||||
|
||||
|
||||
def test_load_module(evaluator):
|
||||
|
||||
Reference in New Issue
Block a user