forked from VimPlug/jedi
Fix some interpreter issues
This commit is contained in:
@@ -10,8 +10,8 @@ from ..helpers import cwd_at
|
||||
|
||||
|
||||
def check_module_test(Script, code):
|
||||
module_value = Script(code)._get_module()
|
||||
return check_sys_path_modifications(module_value)
|
||||
module_context = Script(code)._get_module_context()
|
||||
return check_sys_path_modifications(module_context)
|
||||
|
||||
|
||||
@cwd_at('test/examples/buildout_project/src/proj_name')
|
||||
|
||||
@@ -318,12 +318,13 @@ def test_get_modules_containing_name(inference_state, path, goal, is_package):
|
||||
is_package=is_package,
|
||||
)
|
||||
assert module
|
||||
input_module, found_module = imports.get_modules_containing_name(
|
||||
module_context = module.as_context()
|
||||
input_module, found_module = imports.get_module_contexts_containing_name(
|
||||
inference_state,
|
||||
[module],
|
||||
[module_context],
|
||||
'string_that_only_exists_here'
|
||||
)
|
||||
assert input_module is module
|
||||
assert input_module is module_context
|
||||
assert found_module.string_names == goal
|
||||
|
||||
|
||||
@@ -424,7 +425,7 @@ def test_level_to_import_path(level, directory, project_path, result):
|
||||
|
||||
def test_import_name_calculation(Script):
|
||||
s = Script(path=os.path.join(test_dir, 'completion', 'isinstance.py'))
|
||||
m = s._get_module()
|
||||
m = s._get_module_context()
|
||||
assert m.string_names == ('test', 'completion', 'isinstance')
|
||||
|
||||
|
||||
@@ -434,7 +435,7 @@ def test_pre_defined_imports_module(Script, environment, name):
|
||||
name = '__builtin__'
|
||||
|
||||
path = os.path.join(root_dir, name + '.py')
|
||||
module = Script('', path=path)._get_module()
|
||||
module = Script('', path=path)._get_module_context()
|
||||
assert module.string_names == (name,)
|
||||
|
||||
assert module.inference_state.builtins_module.py__file__() != path
|
||||
|
||||
@@ -14,5 +14,5 @@ def test_equals(Script, environment, source):
|
||||
pytest.skip("Ellipsis does not exists in 2")
|
||||
script = Script(source)
|
||||
node = script._module_node.children[0]
|
||||
first, = script._get_module().infer_node(node)
|
||||
first, = script._get_module_context().infer_node(node)
|
||||
assert isinstance(first, CompiledObject) and first.get_safe_value() is True
|
||||
|
||||
@@ -14,7 +14,7 @@ def test_paths_from_assignment(Script):
|
||||
def paths(src):
|
||||
script = Script(src, path='/foo/bar.py')
|
||||
expr_stmt = script._module_node.children[0]
|
||||
return set(sys_path._paths_from_assignment(script._get_module(), expr_stmt))
|
||||
return set(sys_path._paths_from_assignment(script._get_module_context(), expr_stmt))
|
||||
|
||||
# Normalize paths for Windows.
|
||||
path_a = os.path.abspath('/foo/a')
|
||||
|
||||
Reference in New Issue
Block a user