mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Enable a sys path test that is working now
This commit is contained in:
@@ -61,20 +61,19 @@ def infer_import(context, tree_name):
|
|||||||
module_context = context.get_root_context()
|
module_context = context.get_root_context()
|
||||||
from_import_name, import_path, level, values = \
|
from_import_name, import_path, level, values = \
|
||||||
_prepare_infer_import(module_context, tree_name)
|
_prepare_infer_import(module_context, tree_name)
|
||||||
if not values:
|
if values:
|
||||||
return NO_VALUES
|
|
||||||
|
|
||||||
if from_import_name is not None:
|
if from_import_name is not None:
|
||||||
values = values.py__getattribute__(
|
values = values.py__getattribute__(
|
||||||
from_import_name,
|
from_import_name,
|
||||||
name_context=context,
|
name_context=context,
|
||||||
analysis_errors=False
|
analysis_errors=False
|
||||||
)
|
)
|
||||||
|
|
||||||
if not values:
|
if not values:
|
||||||
path = import_path + (from_import_name,)
|
path = import_path + (from_import_name,)
|
||||||
importer = Importer(context.inference_state, path, module_context, level)
|
importer = Importer(context.inference_state, path, module_context, level)
|
||||||
values = importer.follow()
|
values = importer.follow()
|
||||||
debug.dbg('after import: %s', values)
|
debug.dbg('after import: %s', values)
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import os
|
|||||||
from jedi._compatibility import unicode, force_unicode, all_suffixes
|
from jedi._compatibility import unicode, force_unicode, all_suffixes
|
||||||
from jedi.inference.cache import inference_state_method_cache
|
from jedi.inference.cache import inference_state_method_cache
|
||||||
from jedi.inference.base_value import ContextualizedNode
|
from jedi.inference.base_value import ContextualizedNode
|
||||||
from jedi.inference.helpers import is_string
|
from jedi.inference.helpers import is_string, get_str_or_none
|
||||||
from jedi.common.utils import traverse_parents
|
from jedi.common.utils import traverse_parents
|
||||||
from jedi.parser_utils import get_cached_code_lines
|
from jedi.parser_utils import get_cached_code_lines
|
||||||
from jedi.file_io import FileIO
|
from jedi.file_io import FileIO
|
||||||
@@ -86,10 +86,12 @@ def _paths_from_list_modifications(module_context, trailer1, trailer2):
|
|||||||
arg = arg.children[2]
|
arg = arg.children[2]
|
||||||
|
|
||||||
for value in module_context.create_context(arg).infer_node(arg):
|
for value in module_context.create_context(arg).infer_node(arg):
|
||||||
if is_string(value):
|
p = get_str_or_none(value)
|
||||||
abs_path = _abs_path(module_context, value.get_safe_value())
|
if p is None:
|
||||||
if abs_path is not None:
|
continue
|
||||||
yield abs_path
|
abs_path = _abs_path(module_context, p)
|
||||||
|
if abs_path is not None:
|
||||||
|
yield abs_path
|
||||||
|
|
||||||
|
|
||||||
@inference_state_method_cache(default=[])
|
@inference_state_method_cache(default=[])
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from os import dirname
|
from os.path import dirname
|
||||||
|
|
||||||
sys.path.insert(0, '../../jedi')
|
sys.path.insert(0, '../../jedi')
|
||||||
sys.path.append(dirname(os.path.abspath('thirdparty' + os.path.sep + 'asdf')))
|
sys.path.append(os.path.join(dirname(__file__), 'thirdparty'))
|
||||||
|
|
||||||
# modifications, that should fail:
|
# modifications, that should fail:
|
||||||
# syntax err
|
# syntax err
|
||||||
@@ -17,8 +17,8 @@ import inference
|
|||||||
inference.inference_state_fu
|
inference.inference_state_fu
|
||||||
|
|
||||||
# Those don't work because dirname and abspath are not properly understood.
|
# Those don't work because dirname and abspath are not properly understood.
|
||||||
##? ['jedi_']
|
#? ['jedi_']
|
||||||
import jedi_
|
import jedi_
|
||||||
|
|
||||||
##? ['el']
|
#? ['el']
|
||||||
jedi_.el
|
jedi_.el
|
||||||
|
|||||||
Reference in New Issue
Block a user