Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jedi doesn't work with botostubs for AWS boto3 #1341

Open
pcgeek86 opened this issue Jun 11, 2019 · 7 comments

Comments

Projects
None yet
2 participants
@pcgeek86
Copy link
Contributor

commented Jun 11, 2019

Whereas:

  • Jedi appears to be the default Intellisense engine for the Python VSCode extension
  • The AWS boto3 Python module contains dynamically generated Python classes from API metadata, and doesn't include type hints natively
  • Someone developed the botostubs module to provide type hints for boto3
  • The Jedi Intelliense engine isn't compatible with botostubs

Reproduction Steps

  1. Install Python 3, VSCode, and Python extension for VSCode
  2. pip3 install boto3, botostubs
  3. Create a new Python file similar to the below
import boto3, botostubs
s3: botostubs.S3 = boto3.client('s3')

Then, try typing s3. and see if Intellisense results show up. You probably won't see the expected results [ print(item) for item in dir(s3) ].

abort_multipart_upload
can_paginate
complete_multipart_upload
copy
copy_object
create_bucket
create_multipart_upload
delete_bucket
delete_bucket_analytics_configuration
delete_bucket_cors
delete_bucket_encryption
delete_bucket_inventory_configuration
delete_bucket_lifecycle
delete_bucket_metrics_configuration
delete_bucket_policy
delete_bucket_replication
delete_bucket_tagging
delete_bucket_website
delete_object
delete_object_tagging
delete_objects
delete_public_access_block
download_file
download_fileobj
exceptions
generate_presigned_post
generate_presigned_url
get_bucket_accelerate_configuration
get_bucket_acl
get_bucket_analytics_configuration
get_bucket_cors
get_bucket_encryption
get_bucket_inventory_configuration
get_bucket_lifecycle
get_bucket_lifecycle_configuration
get_bucket_location
get_bucket_logging
get_bucket_metrics_configuration
get_bucket_notification
get_bucket_notification_configuration
get_bucket_policy
get_bucket_policy_status
get_bucket_replication
get_bucket_request_payment
get_bucket_tagging
get_bucket_versioning
get_bucket_website
get_object
get_object_acl
get_object_legal_hold
get_object_lock_configuration
get_object_retention
get_object_tagging
get_object_torrent
get_paginator
get_public_access_block
get_waiter
head_bucket
head_object
list_bucket_analytics_configurations
list_bucket_inventory_configurations
list_bucket_metrics_configurations
list_buckets
list_multipart_uploads
list_object_versions
list_objects
list_objects_v2
list_parts
meta
put_bucket_accelerate_configuration
put_bucket_acl
put_bucket_analytics_configuration
put_bucket_cors
put_bucket_encryption
put_bucket_inventory_configuration
put_bucket_lifecycle
put_bucket_lifecycle_configuration
put_bucket_logging
put_bucket_metrics_configuration
put_bucket_notification
put_bucket_notification_configuration
put_bucket_policy
put_bucket_replication
put_bucket_request_payment
put_bucket_tagging
put_bucket_versioning
put_bucket_website
put_object
put_object_acl
put_object_legal_hold
put_object_lock_configuration
put_object_retention
put_object_tagging
put_public_access_block
restore_object
select_object_content
upload_file
upload_fileobj
upload_part
upload_part_copy
waiter_names

Disable Jedi, and then try again with the Microsoft Python Language Server Intellisense engine. It should work.

It would be great if this could get resolved, so we can use Jedi and also benefit from the botostubs module's type hints.

@davidhalter

This comment has been minimized.

Copy link
Owner

commented Jun 11, 2019

Can you try current master? It should work now. See also discussion in #839.

@pcgeek86

This comment has been minimized.

Copy link
Contributor Author

commented Jun 11, 2019

I'm struggling to figure out how to get this working.

  • Clone the master branch locally
  • Run tox
  • Error: typeshed submodule is required
  • However, I already have typeshed installed
PS /Users/trevor/git/jedi> tox
GLOB sdist-make: /Users/trevor/git/jedi/setup.py
ERROR: invocation failed (exit code 1), logfile: /Users/trevor/git/jedi/.tox/log/GLOB-0.log
================================================================================================================= log start ==================================================================================================================
Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    "Please download the typeshed submodule first"
AssertionError: Please download the typeshed submodule first

================================================================================================================== log end ===================================================================================================================
ERROR: FAIL could not package project - v = InvocationError('/usr/local/opt/python/bin/python3.7 setup.py sdist --formats=zip --dist-dir /Users/trevor/git/jedi/.tox/dist', 1)
PS /Users/trevor/git/jedi> pip3 install typeshed
Requirement already satisfied: typeshed in /usr/local/lib/python3.7/site-packages (0.0.1)

When I try to install it, per the documentation, I receive the same error about the typeshed submodule.

PS /Users/trevor/git/jedi> sudo python3 setup.py install
Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    "Please download the typeshed submodule first"
AssertionError: Please download the typeshed submodule first
@davidhalter

This comment has been minimized.

Copy link
Owner

commented Jun 11, 2019

git clone --recurse-submodules helps :)
or in your case git submodule update --init

davidhalter added a commit that referenced this issue Jun 11, 2019

@davidhalter

This comment has been minimized.

Copy link
Owner

commented Jun 11, 2019

Almost forgot, you need to checkout latest parso as well.

@pcgeek86

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

Good deal, the git submodule update --init command worked fine.

Do I have to check out parso somewhere specifically on the filesystem, so Jedi can find it? The parso integration tests in Jedi actually passed, when I ran tox, so .... maybe I'm good to go already?

test/test_parso_integration/test_basic.py .....s                                                                                                                                                                                       [ 99%]
test/test_parso_integration/test_error_correction.py ....                                                                                                                                                                              [ 99%]
test/test_parso_integration/test_parser_utils.py ........                                                                                                                                                                              [100%]
@pcgeek86

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

Also, I received a bunch of test errors later on:

_______________________________________________________________________________________________________ [doctest] jedi.api.Interpreter _______________________________________________________________________________________________________
451
452     In addition to completion of simple attribute access, Jedi
453     supports code completion based on static code analysis.
454     Jedi can complete attributes of object which is not initialized
455     yet.
456
457     >>> from os.path import join
458     >>> namespace = locals()
459     >>> script = Interpreter('join("").up', [namespace])
460     >>> print(script.completions()[0].name)
UNEXPECTED EXCEPTION: AssertionError()
Traceback (most recent call last):

  File "/Users/trevor/git/jedi/jedi/cache.py", line 46, in wrapper
    return getattr(self, name)

AttributeError: 'MixedName' object has no attribute '_infer'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/Users/trevor/git/jedi/jedi/evaluate/compiled/access.py", line 112, in wrapper
    cache[key]

KeyError: 4349110424


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/doctest.py", line 1329, in __run
    compileflags, 1), test.globs)

  File "<doctest jedi.api.Interpreter[3]>", line 1, in <module>

  File "/Users/trevor/git/jedi/jedi/api/__init__.py", line 216, in completions
    completions = completion.completions()

  File "/Users/trevor/git/jedi/jedi/api/completion.py", line 99, in completions
    completion_names = self._get_context_completions()

  File "/Users/trevor/git/jedi/jedi/api/completion.py", line 204, in _get_context_completions
    completion_names += self._trailer_completions(dot.get_previous_leaf())

  File "/Users/trevor/git/jedi/jedi/api/completion.py", line 240, in _trailer_completions
    contexts = evaluate_call_of_leaf(evaluation_context, previous_leaf)

  File "/Users/trevor/git/jedi/jedi/evaluate/helpers.py", line 102, in evaluate_call_of_leaf
    values = context.eval_node(base)

  File "/Users/trevor/git/jedi/jedi/evaluate/base_context.py", line 79, in eval_node
    return self.evaluator.eval_element(self, node)

  File "/Users/trevor/git/jedi/jedi/evaluate/__init__.py", line 239, in eval_element
    return self._eval_element_if_evaluated(context, element)

  File "/Users/trevor/git/jedi/jedi/evaluate/__init__.py", line 251, in _eval_element_if_evaluated
    return self._eval_element_cached(context, element)

  File "/Users/trevor/git/jedi/jedi/evaluate/cache.py", line 42, in wrapper
    rv = function(obj, *args, **kwargs)

  File "/Users/trevor/git/jedi/jedi/evaluate/__init__.py", line 255, in _eval_element_cached
    return eval_node(context, element)

  File "/Users/trevor/git/jedi/jedi/debug.py", line 82, in wrapper
    return func(*args, **kwargs)

  File "/Users/trevor/git/jedi/jedi/evaluate/syntax_tree.py", line 50, in wrapper
    return func(context, *args, **kwargs)

  File "/Users/trevor/git/jedi/jedi/evaluate/syntax_tree.py", line 74, in eval_node
    return eval_atom(context, element)

  File "/Users/trevor/git/jedi/jedi/evaluate/syntax_tree.py", line 203, in eval_atom
    search_global=True

  File "/Users/trevor/git/jedi/jedi/evaluate/base_context.py", line 70, in py__getattribute__
    return f.find(filters, attribute_lookup=not search_global)

  File "/Users/trevor/git/jedi/jedi/evaluate/finder.py", line 67, in find
    types = self._names_to_types(names, attribute_lookup)

  File "/Users/trevor/git/jedi/jedi/evaluate/finder.py", line 190, in _names_to_types
    contexts = ContextSet.from_sets(name.infer() for name in names)

  File "/Users/trevor/git/jedi/jedi/common/context.py", line 32, in from_sets
    for set_ in sets:

  File "/Users/trevor/git/jedi/jedi/evaluate/finder.py", line 190, in <genexpr>
    contexts = ContextSet.from_sets(name.infer() for name in names)

  File "/Users/trevor/git/jedi/jedi/cache.py", line 48, in wrapper
    result = func(self)

  File "/Users/trevor/git/jedi/jedi/evaluate/compiled/mixed.py", line 105, in infer
    for c in contexts

  File "/Users/trevor/git/jedi/jedi/common/context.py", line 32, in from_sets
    for set_ in sets:

  File "/Users/trevor/git/jedi/jedi/evaluate/compiled/mixed.py", line 105, in <genexpr>
    for c in contexts

  File "/Users/trevor/git/jedi/jedi/evaluate/compiled/access.py", line 117, in wrapper
    result = func(evaluator, obj, parent_context)

  File "/Users/trevor/git/jedi/jedi/evaluate/compiled/mixed.py", line 254, in _create
    assert parent_context.tree_node.get_root_node() == module_node

AssertionError

/Users/trevor/git/jedi/jedi/api/__init__.py:460: UnexpectedException
_______________________________________________________________________________________________________ TestSetupReadline.test_import ________________________________________________________________________________________________________

self = <test.test_utils.TestSetupReadline testMethod=test_import>

    def test_import(self):
        s = 'from os.path import a'
        assert set(self.completions(s)) == {s + 'ltsep', s + 'bspath'}
        assert self.completions('import keyword') == ['import keyword']

        import os
        s = 'from os import '
        goal = {s + el for el in dir(os)}
        # There are minor differences, e.g. the dir doesn't include deleted
        # items as well as items that are not only available on linux.
        difference = set(self.completions(s)).symmetric_difference(goal)
        difference = {x for x in difference if not x.startswith('from os import _')}
        # There are quite a few differences, because both Windows and Linux
        # (posix and nt) libraries are included.
>       assert len(difference) < 38
E       AssertionError: assert 72 < 38
E        +  where 72 = len({'from os import EX_NOTFOUND', 'from os import GRND_NONBLOCK', 'from os import GRND_RANDOM', 'from os import O_BINARY', 'from os import O_DIRECT', 'from os import O_LARGEFILE', ...})

test/test_utils.py:83: AssertionError
_______________________________________________________________________________________________________ TestSetupReadline.test_modules _______________________________________________________________________________________________________

self = <MixedName: (<CompiledContextName: string_name=posixpath>).join>

    def wrapper(self):
        try:
>           return getattr(self, name)
E           AttributeError: 'MixedName' object has no attribute '_infer'

jedi/cache.py:46: AttributeError

During handling of the above exception, another exception occurred:

evaluator = <jedi.evaluate.Evaluator object at 0x1071dbda0>, obj = <AccessHandle of DirectObjectAccess(<function join at 0x100a3b7b8>)>
parent_context = <MixedObject: <module 'posixpath' from '/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py'>>

    def wrapper(evaluator, obj, parent_context=None):
        cache = getattr(evaluator, attribute_name)
        # Do a very cheap form of caching here.
        key = id(obj)
        try:
>           cache[key]
E           KeyError: 4410690136

jedi/evaluate/compiled/access.py:112: KeyError

During handling of the above exception, another exception occurred:

self = <test.test_utils.TestSetupReadline testMethod=test_modules>

    def test_modules(self):
        import sys
        import os
        self.namespace.sys = sys
        self.namespace.os = os

        try:
>           assert self.completions('os.path.join') == ['os.path.join']

test/test_utils.py:55:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/test_utils.py:27: in completions
    completion = completer(text, i)
jedi/utils.py:97: in complete
    completions = interpreter.completions()
jedi/api/__init__.py:216: in completions
    completions = completion.completions()
jedi/api/completion.py:104: in completions
    return sorted(completions, key=lambda x: (x.name.startswith('__'),
jedi/api/completion.py:44: in filter_names
    k = (new.name, new.complete)  # key
jedi/api/classes.py:431: in complete
    return self._complete(True)
jedi/api/classes.py:400: in _complete
    if self._name.api_type == 'param' and self._stack is not None:
jedi/evaluate/compiled/mixed.py:111: in api_type
    return next(iter(self.infer())).api_type
jedi/cache.py:48: in wrapper
    result = func(self)
jedi/evaluate/compiled/mixed.py:105: in infer
    for c in contexts
jedi/common/context.py:32: in from_sets
    for set_ in sets:
jedi/evaluate/compiled/mixed.py:105: in <genexpr>
    for c in contexts
jedi/evaluate/compiled/access.py:117: in wrapper
    result = func(evaluator, obj, parent_context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

evaluator = <jedi.evaluate.Evaluator object at 0x1071dbda0>, access_handle = <AccessHandle of DirectObjectAccess(<function join at 0x100a3b7b8>)>
parent_context = <MixedObject: <module 'posixpath' from '/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py'>>, args = ()
result = (<Module: @1-530>, <Function: join@75-97>, FileIO(/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py),... on other systems (e.g. Mac, Windows),\n', 'os.path provides the same operations in a manner specific to that\n', ...])

    @compiled_objects_cache('mixed_cache')
    def _create(evaluator, access_handle, parent_context, *args):
        compiled_object = create_cached_compiled_object(
            evaluator,
            access_handle,
            parent_context=parent_context and parent_context.compiled_object
        )

        result = _find_syntax_node_name(evaluator, access_handle)
        if result is None:
            # TODO Care about generics from stuff like `[1]` and don't return like this.
            python_object = access_handle.access._obj
            if type(python_object) in (dict, list, tuple):
                return ContextSet({compiled_object})

            tree_contexts = to_stub(compiled_object)
            if not tree_contexts:
                return ContextSet({compiled_object})
        else:
            module_node, tree_node, file_io, code_lines = result

            if parent_context is None:
                # TODO this __name__ is probably wrong.
                name = compiled_object.get_root_context().py__name__()
                string_names = tuple(name.split('.'))
                module_context = ModuleContext(
                    evaluator, module_node,
                    file_io=file_io,
                    string_names=string_names,
                    code_lines=code_lines,
                    is_package=hasattr(compiled_object, 'py__path__'),
                )
                if name is not None:
                    evaluator.module_cache.add(string_names, ContextSet([module_context]))
            else:
>               assert parent_context.tree_node.get_root_node() == module_node
E               AssertionError

jedi/evaluate/compiled/mixed.py:254: AssertionError
------------------------------------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------------------------------------
ERROR    root:utils.py:100 REPL Completion error:
                           Traceback (most recent call last):
                             File "/Users/trevor/git/jedi/jedi/cache.py", line 46, in wrapper
                               return getattr(self, name)
                           AttributeError: 'MixedName' object has no attribute '_infer'

                           During handling of the above exception, another exception occurred:

                           Traceback (most recent call last):
                             File "/Users/trevor/git/jedi/jedi/evaluate/compiled/access.py", line 112, in wrapper
                               cache[key]
                           KeyError: 4410690136

                           During handling of the above exception, another exception occurred:

                           Traceback (most recent call last):
                             File "/Users/trevor/git/jedi/jedi/utils.py", line 97, in complete
                               completions = interpreter.completions()
                             File "/Users/trevor/git/jedi/jedi/api/__init__.py", line 216, in completions
                               completions = completion.completions()
                             File "/Users/trevor/git/jedi/jedi/api/completion.py", line 104, in completions
                               return sorted(completions, key=lambda x: (x.name.startswith('__'),
                             File "/Users/trevor/git/jedi/jedi/api/completion.py", line 44, in filter_names
                               k = (new.name, new.complete)  # key
                             File "/Users/trevor/git/jedi/jedi/api/classes.py", line 431, in complete
                               return self._complete(True)
                             File "/Users/trevor/git/jedi/jedi/api/classes.py", line 400, in _complete
                               if self._name.api_type == 'param' and self._stack is not None:
                             File "/Users/trevor/git/jedi/jedi/evaluate/compiled/mixed.py", line 111, in api_type
                               return next(iter(self.infer())).api_type
                             File "/Users/trevor/git/jedi/jedi/cache.py", line 48, in wrapper
                               result = func(self)
                             File "/Users/trevor/git/jedi/jedi/evaluate/compiled/mixed.py", line 105, in infer
                               for c in contexts
                             File "/Users/trevor/git/jedi/jedi/common/context.py", line 32, in from_sets
                               for set_ in sets:
                             File "/Users/trevor/git/jedi/jedi/evaluate/compiled/mixed.py", line 105, in <genexpr>
                               for c in contexts
                             File "/Users/trevor/git/jedi/jedi/evaluate/compiled/access.py", line 117, in wrapper
                               result = func(evaluator, obj, parent_context)
                             File "/Users/trevor/git/jedi/jedi/evaluate/compiled/mixed.py", line 254, in _create
                               assert parent_context.tree_node.get_root_node() == module_node
                           AssertionError
____________________________________________________________________________________________________________ test_scanning_venvs _____________________________________________________________________________________________________________

venv_path = '/private/var/folders/dj/r2pgr6xs46sgs6xqfhh2dlc40000gn/T/pytest-of-trevor/pytest-1/venv'

    def test_scanning_venvs(venv_path):
        parent_dir = os.path.dirname(venv_path)
>       assert any(venv.path == venv_path
                   for venv in find_virtualenvs([parent_dir]))
E       assert False
E        +  where False = any(<generator object test_scanning_venvs.<locals>.<genexpr> at 0x1073aed68>)

test/test_api/test_environment.py:107: AssertionError
_____________________________________________________________________________________________________ test_create_environment_venv_path ______________________________________________________________________________________________________

venv_path = '/private/var/folders/dj/r2pgr6xs46sgs6xqfhh2dlc40000gn/T/pytest-of-trevor/pytest-1/venv'

    def test_create_environment_venv_path(venv_path):
>       environment = create_environment(venv_path)

test/test_api/test_environment.py:112:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
jedi/api/environment.py:355: in create_environment
    return Environment(_get_executable_path(path, safe=safe))
jedi/api/environment.py:370: in _get_executable_path
    _assert_safe(python, safe)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

executable_path = '/private/var/folders/dj/r2pgr6xs46sgs6xqfhh2dlc40000gn/T/pytest-of-trevor/pytest-1/venv/bin/python', safe = True

    def _assert_safe(executable_path, safe):
        if safe and not _is_safe(executable_path):
            raise InvalidPythonEnvironment(
>               "The python binary is potentially unsafe.")
E           jedi.api.environment.InvalidPythonEnvironment: The python binary is potentially unsafe.

jedi/api/environment.py:404: InvalidPythonEnvironment
_________________________________________________________________________________________________________ test_complete_raw_function _________________________________________________________________________________________________________

self = <MixedName: (<CompiledContextName: string_name=>).join>

    def wrapper(self):
        try:
>           return getattr(self, name)
E           AttributeError: 'MixedName' object has no attribute '_infer'

jedi/cache.py:46: AttributeError

During handling of the above exception, another exception occurred:

evaluator = <jedi.evaluate.Evaluator object at 0x10674f2e8>, obj = <AccessHandle of DirectObjectAccess(<function join at 0x100a3b7b8>)>
parent_context = <MixedObject: <module 'posixpath' from '/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py'>>

    def wrapper(evaluator, obj, parent_context=None):
        cache = getattr(evaluator, attribute_name)
        # Do a very cheap form of caching here.
        key = id(obj)
        try:
>           cache[key]
E           KeyError: 4413547520

jedi/evaluate/compiled/access.py:112: KeyError

During handling of the above exception, another exception occurred:

    def test_complete_raw_function():
        from os.path import join
        _assert_interpreter_complete('join("").up',
                                     locals(),
>                                    ['upper'])

test/test_api/test_interpreter.py:122:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/test_api/test_interpreter.py:113: in _assert_interpreter_complete
    cs = script.completions()
jedi/api/__init__.py:216: in completions
    completions = completion.completions()
jedi/api/completion.py:99: in completions
    completion_names = self._get_context_completions()
jedi/api/completion.py:204: in _get_context_completions
    completion_names += self._trailer_completions(dot.get_previous_leaf())
jedi/api/completion.py:240: in _trailer_completions
    contexts = evaluate_call_of_leaf(evaluation_context, previous_leaf)
jedi/evaluate/helpers.py:102: in evaluate_call_of_leaf
    values = context.eval_node(base)
jedi/evaluate/base_context.py:79: in eval_node
    return self.evaluator.eval_element(self, node)
jedi/evaluate/__init__.py:239: in eval_element
    return self._eval_element_if_evaluated(context, element)
jedi/evaluate/__init__.py:251: in _eval_element_if_evaluated
    return self._eval_element_cached(context, element)
jedi/evaluate/cache.py:42: in wrapper
    rv = function(obj, *args, **kwargs)
jedi/evaluate/__init__.py:255: in _eval_element_cached
    return eval_node(context, element)
jedi/debug.py:82: in wrapper
    return func(*args, **kwargs)
jedi/evaluate/syntax_tree.py:50: in wrapper
    return func(context, *args, **kwargs)
jedi/evaluate/syntax_tree.py:74: in eval_node
    return eval_atom(context, element)
jedi/evaluate/syntax_tree.py:203: in eval_atom
    search_global=True
jedi/evaluate/base_context.py:70: in py__getattribute__
    return f.find(filters, attribute_lookup=not search_global)
jedi/evaluate/finder.py:67: in find
    types = self._names_to_types(names, attribute_lookup)
jedi/evaluate/finder.py:190: in _names_to_types
    contexts = ContextSet.from_sets(name.infer() for name in names)
jedi/common/context.py:32: in from_sets
    for set_ in sets:
jedi/evaluate/finder.py:190: in <genexpr>
    contexts = ContextSet.from_sets(name.infer() for name in names)
jedi/cache.py:48: in wrapper
    result = func(self)
jedi/evaluate/compiled/mixed.py:105: in infer
    for c in contexts
jedi/common/context.py:32: in from_sets
    for set_ in sets:
jedi/evaluate/compiled/mixed.py:105: in <genexpr>
    for c in contexts
jedi/evaluate/compiled/access.py:117: in wrapper
    result = func(evaluator, obj, parent_context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

evaluator = <jedi.evaluate.Evaluator object at 0x10674f2e8>, access_handle = <AccessHandle of DirectObjectAccess(<function join at 0x100a3b7b8>)>
parent_context = <MixedObject: <module 'posixpath' from '/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py'>>, args = ()
result = (<Module: @1-530>, <Function: join@75-97>, FileIO(/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py),... on other systems (e.g. Mac, Windows),\n', 'os.path provides the same operations in a manner specific to that\n', ...])

    @compiled_objects_cache('mixed_cache')
    def _create(evaluator, access_handle, parent_context, *args):
        compiled_object = create_cached_compiled_object(
            evaluator,
            access_handle,
            parent_context=parent_context and parent_context.compiled_object
        )

        result = _find_syntax_node_name(evaluator, access_handle)
        if result is None:
            # TODO Care about generics from stuff like `[1]` and don't return like this.
            python_object = access_handle.access._obj
            if type(python_object) in (dict, list, tuple):
                return ContextSet({compiled_object})

            tree_contexts = to_stub(compiled_object)
            if not tree_contexts:
                return ContextSet({compiled_object})
        else:
            module_node, tree_node, file_io, code_lines = result

            if parent_context is None:
                # TODO this __name__ is probably wrong.
                name = compiled_object.get_root_context().py__name__()
                string_names = tuple(name.split('.'))
                module_context = ModuleContext(
                    evaluator, module_node,
                    file_io=file_io,
                    string_names=string_names,
                    code_lines=code_lines,
                    is_package=hasattr(compiled_object, 'py__path__'),
                )
                if name is not None:
                    evaluator.module_cache.add(string_names, ContextSet([module_context]))
            else:
>               assert parent_context.tree_node.get_root_node() == module_node
E               AssertionError

jedi/evaluate/compiled/mixed.py:254: AssertionError
_________________________________________________________________________________________________ test_complete_raw_function_different_name __________________________________________________________________________________________________

self = <MixedName: (<CompiledContextName: string_name=>).pjoin>

    def wrapper(self):
        try:
>           return getattr(self, name)
E           AttributeError: 'MixedName' object has no attribute '_infer'

jedi/cache.py:46: AttributeError

During handling of the above exception, another exception occurred:

evaluator = <jedi.evaluate.Evaluator object at 0x106db0550>, obj = <AccessHandle of DirectObjectAccess(<function join at 0x100a3b7b8>)>
parent_context = <MixedObject: <module 'posixpath' from '/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py'>>

    def wrapper(evaluator, obj, parent_context=None):
        cache = getattr(evaluator, attribute_name)
        # Do a very cheap form of caching here.
        key = id(obj)
        try:
>           cache[key]
E           KeyError: 4409906736

jedi/evaluate/compiled/access.py:112: KeyError

During handling of the above exception, another exception occurred:

    def test_complete_raw_function_different_name():
        from os.path import join as pjoin
        _assert_interpreter_complete('pjoin("").up',
                                     locals(),
>                                    ['upper'])

test/test_api/test_interpreter.py:129:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/test_api/test_interpreter.py:113: in _assert_interpreter_complete
    cs = script.completions()
jedi/api/__init__.py:216: in completions
    completions = completion.completions()
jedi/api/completion.py:99: in completions
    completion_names = self._get_context_completions()
jedi/api/completion.py:204: in _get_context_completions
    completion_names += self._trailer_completions(dot.get_previous_leaf())
jedi/api/completion.py:240: in _trailer_completions
    contexts = evaluate_call_of_leaf(evaluation_context, previous_leaf)
jedi/evaluate/helpers.py:102: in evaluate_call_of_leaf
    values = context.eval_node(base)
jedi/evaluate/base_context.py:79: in eval_node
    return self.evaluator.eval_element(self, node)
jedi/evaluate/__init__.py:239: in eval_element
    return self._eval_element_if_evaluated(context, element)
jedi/evaluate/__init__.py:251: in _eval_element_if_evaluated
    return self._eval_element_cached(context, element)
jedi/evaluate/cache.py:42: in wrapper
    rv = function(obj, *args, **kwargs)
jedi/evaluate/__init__.py:255: in _eval_element_cached
    return eval_node(context, element)
jedi/debug.py:82: in wrapper
    return func(*args, **kwargs)
jedi/evaluate/syntax_tree.py:50: in wrapper
    return func(context, *args, **kwargs)
jedi/evaluate/syntax_tree.py:74: in eval_node
    return eval_atom(context, element)
jedi/evaluate/syntax_tree.py:203: in eval_atom
    search_global=True
jedi/evaluate/base_context.py:70: in py__getattribute__
    return f.find(filters, attribute_lookup=not search_global)
jedi/evaluate/finder.py:67: in find
    types = self._names_to_types(names, attribute_lookup)
jedi/evaluate/finder.py:190: in _names_to_types
    contexts = ContextSet.from_sets(name.infer() for name in names)
jedi/common/context.py:32: in from_sets
    for set_ in sets:
jedi/evaluate/finder.py:190: in <genexpr>
    contexts = ContextSet.from_sets(name.infer() for name in names)
jedi/cache.py:48: in wrapper
    result = func(self)
jedi/evaluate/compiled/mixed.py:105: in infer
    for c in contexts
jedi/common/context.py:32: in from_sets
    for set_ in sets:
jedi/evaluate/compiled/mixed.py:105: in <genexpr>
    for c in contexts
jedi/evaluate/compiled/access.py:117: in wrapper
    result = func(evaluator, obj, parent_context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

evaluator = <jedi.evaluate.Evaluator object at 0x106db0550>, access_handle = <AccessHandle of DirectObjectAccess(<function join at 0x100a3b7b8>)>
parent_context = <MixedObject: <module 'posixpath' from '/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py'>>, args = ()
result = (<Module: @1-530>, <Function: join@75-97>, FileIO(/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py),... on other systems (e.g. Mac, Windows),\n', 'os.path provides the same operations in a manner specific to that\n', ...])

    @compiled_objects_cache('mixed_cache')
    def _create(evaluator, access_handle, parent_context, *args):
        compiled_object = create_cached_compiled_object(
            evaluator,
            access_handle,
            parent_context=parent_context and parent_context.compiled_object
        )

        result = _find_syntax_node_name(evaluator, access_handle)
        if result is None:
            # TODO Care about generics from stuff like `[1]` and don't return like this.
            python_object = access_handle.access._obj
            if type(python_object) in (dict, list, tuple):
                return ContextSet({compiled_object})

            tree_contexts = to_stub(compiled_object)
            if not tree_contexts:
                return ContextSet({compiled_object})
        else:
            module_node, tree_node, file_io, code_lines = result

            if parent_context is None:
                # TODO this __name__ is probably wrong.
                name = compiled_object.get_root_context().py__name__()
                string_names = tuple(name.split('.'))
                module_context = ModuleContext(
                    evaluator, module_node,
                    file_io=file_io,
                    string_names=string_names,
                    code_lines=code_lines,
                    is_package=hasattr(compiled_object, 'py__path__'),
                )
                if name is not None:
                    evaluator.module_cache.add(string_names, ContextSet([module_context]))
            else:
>               assert parent_context.tree_node.get_root_node() == module_node
E               AssertionError

jedi/evaluate/compiled/mixed.py:254: AssertionError
__________________________________________________________________________________________________________ test_complete_raw_module __________________________________________________________________________________________________________

self = <MixedName: (<CompiledContextName: string_name=posixpath>).join>

    def wrapper(self):
        try:
>           return getattr(self, name)
E           AttributeError: 'MixedName' object has no attribute '_infer'

jedi/cache.py:46: AttributeError

During handling of the above exception, another exception occurred:

evaluator = <jedi.evaluate.Evaluator object at 0x106ccd240>, obj = <AccessHandle of DirectObjectAccess(<function join at 0x100a3b7b8>)>
parent_context = <MixedObject: <module 'posixpath' from '/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py'>>

    def wrapper(evaluator, obj, parent_context=None):
        cache = getattr(evaluator, attribute_name)
        # Do a very cheap form of caching here.
        key = id(obj)
        try:
>           cache[key]
E           KeyError: 4409172376

jedi/evaluate/compiled/access.py:112: KeyError

During handling of the above exception, another exception occurred:

    def test_complete_raw_module():
        import os
        _assert_interpreter_complete('os.path.join("a").up',
                                     locals(),
>                                    ['upper'])

test/test_api/test_interpreter.py:136:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/test_api/test_interpreter.py:113: in _assert_interpreter_complete
    cs = script.completions()
jedi/api/__init__.py:216: in completions
    completions = completion.completions()
jedi/api/completion.py:99: in completions
    completion_names = self._get_context_completions()
jedi/api/completion.py:204: in _get_context_completions
    completion_names += self._trailer_completions(dot.get_previous_leaf())
jedi/api/completion.py:240: in _trailer_completions
    contexts = evaluate_call_of_leaf(evaluation_context, previous_leaf)
jedi/evaluate/helpers.py:105: in evaluate_call_of_leaf
    values = eval_trailer(context, values, trailer)
jedi/evaluate/syntax_tree.py:167: in eval_trailer
    name_or_str=node
jedi/evaluate/base_context.py:404: in py__getattribute__
    return ContextSet.from_sets(c.py__getattribute__(*args, **kwargs) for c in self._set)
jedi/common/context.py:32: in from_sets
    for set_ in sets:
jedi/evaluate/base_context.py:404: in <genexpr>
    return ContextSet.from_sets(c.py__getattribute__(*args, **kwargs) for c in self._set)
jedi/evaluate/base_context.py:70: in py__getattribute__
    return f.find(filters, attribute_lookup=not search_global)
jedi/evaluate/finder.py:67: in find
    types = self._names_to_types(names, attribute_lookup)
jedi/evaluate/finder.py:190: in _names_to_types
    contexts = ContextSet.from_sets(name.infer() for name in names)
jedi/common/context.py:32: in from_sets
    for set_ in sets:
jedi/evaluate/finder.py:190: in <genexpr>
    contexts = ContextSet.from_sets(name.infer() for name in names)
jedi/cache.py:48: in wrapper
    result = func(self)
jedi/evaluate/compiled/mixed.py:105: in infer
    for c in contexts
jedi/common/context.py:32: in from_sets
    for set_ in sets:
jedi/evaluate/compiled/mixed.py:105: in <genexpr>
    for c in contexts
jedi/evaluate/compiled/access.py:117: in wrapper
    result = func(evaluator, obj, parent_context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

evaluator = <jedi.evaluate.Evaluator object at 0x106ccd240>, access_handle = <AccessHandle of DirectObjectAccess(<function join at 0x100a3b7b8>)>
parent_context = <MixedObject: <module 'posixpath' from '/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py'>>, args = ()
result = (<Module: @1-530>, <Function: join@75-97>, FileIO(/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/posixpath.py),... on other systems (e.g. Mac, Windows),\n', 'os.path provides the same operations in a manner specific to that\n', ...])

    @compiled_objects_cache('mixed_cache')
    def _create(evaluator, access_handle, parent_context, *args):
        compiled_object = create_cached_compiled_object(
            evaluator,
            access_handle,
            parent_context=parent_context and parent_context.compiled_object
        )

        result = _find_syntax_node_name(evaluator, access_handle)
        if result is None:
            # TODO Care about generics from stuff like `[1]` and don't return like this.
            python_object = access_handle.access._obj
            if type(python_object) in (dict, list, tuple):
                return ContextSet({compiled_object})

            tree_contexts = to_stub(compiled_object)
            if not tree_contexts:
                return ContextSet({compiled_object})
        else:
            module_node, tree_node, file_io, code_lines = result

            if parent_context is None:
                # TODO this __name__ is probably wrong.
                name = compiled_object.get_root_context().py__name__()
                string_names = tuple(name.split('.'))
                module_context = ModuleContext(
                    evaluator, module_node,
                    file_io=file_io,
                    string_names=string_names,
                    code_lines=code_lines,
                    is_package=hasattr(compiled_object, 'py__path__'),
                )
                if name is not None:
                    evaluator.module_cache.add(string_names, ContextSet([module_context]))
            else:
>               assert parent_context.tree_node.get_root_node() == module_node
E               AssertionError

jedi/evaluate/compiled/mixed.py:254: AssertionError
________________________________________________________________________________________________________________ test_on_code ________________________________________________________________________________________________________________

self = <MixedName: (<CompiledContextName: string_name=>).wraps>

    def wrapper(self):
        try:
>           return getattr(self, name)
E           AttributeError: 'MixedName' object has no attribute '_infer'

jedi/cache.py:46: AttributeError

During handling of the above exception, another exception occurred:

evaluator = <jedi.evaluate.Evaluator object at 0x1079db208>, obj = <AccessHandle of DirectObjectAccess(<function wraps at 0x1009e7bf8>)>
parent_context = <MixedObject: <module 'functools' from '/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/functools.py'>>

    def wrapper(evaluator, obj, parent_context=None):
        cache = getattr(evaluator, attribute_name)
        # Do a very cheap form of caching here.
        key = id(obj)
        try:
>           cache[key]
E           KeyError: 4422688328

jedi/evaluate/compiled/access.py:112: KeyError

During handling of the above exception, another exception occurred:

    def test_on_code():
        from functools import wraps
        i = jedi.Interpreter("wraps.__code__", [{'wraps':wraps}])
>       assert i.goto_definitions()

test/test_evaluate/test_mixed.py:7:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
jedi/api/__init__.py:253: in goto_definitions
    return self._goto_definitions(**kwargs)
jedi/api/__init__.py:264: in _goto_definitions
    contexts = helpers.evaluate_goto_definition(self._evaluator, context, leaf)
jedi/api/helpers.py:144: in evaluate_goto_definition
    return evaluator.goto_definitions(context, leaf)
jedi/evaluate/__init__.py:286: in goto_definitions
    return helpers.evaluate_call_of_leaf(context, name)
jedi/evaluate/helpers.py:102: in evaluate_call_of_leaf
    values = context.eval_node(base)
jedi/evaluate/base_context.py:79: in eval_node
    return self.evaluator.eval_element(self, node)
jedi/evaluate/__init__.py:239: in eval_element
    return self._eval_element_if_evaluated(context, element)
jedi/evaluate/__init__.py:251: in _eval_element_if_evaluated
    return self._eval_element_cached(context, element)
jedi/evaluate/cache.py:42: in wrapper
    rv = function(obj, *args, **kwargs)
jedi/evaluate/__init__.py:255: in _eval_element_cached
    return eval_node(context, element)
jedi/debug.py:82: in wrapper
    return func(*args, **kwargs)
jedi/evaluate/syntax_tree.py:50: in wrapper
    return func(context, *args, **kwargs)
jedi/evaluate/syntax_tree.py:74: in eval_node
    return eval_atom(context, element)
jedi/evaluate/syntax_tree.py:203: in eval_atom
    search_global=True
jedi/evaluate/base_context.py:70: in py__getattribute__
    return f.find(filters, attribute_lookup=not search_global)
jedi/evaluate/finder.py:67: in find
    types = self._names_to_types(names, attribute_lookup)
jedi/evaluate/finder.py:190: in _names_to_types
    contexts = ContextSet.from_sets(name.infer() for name in names)
jedi/common/context.py:32: in from_sets
    for set_ in sets:
jedi/evaluate/finder.py:190: in <genexpr>
    contexts = ContextSet.from_sets(name.infer() for name in names)
jedi/cache.py:48: in wrapper
    result = func(self)
jedi/evaluate/compiled/mixed.py:105: in infer
    for c in contexts
jedi/common/context.py:32: in from_sets
    for set_ in sets:
jedi/evaluate/compiled/mixed.py:105: in <genexpr>
    for c in contexts
jedi/evaluate/compiled/access.py:117: in wrapper
    result = func(evaluator, obj, parent_context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

evaluator = <jedi.evaluate.Evaluator object at 0x1079db208>, access_handle = <AccessHandle of DirectObjectAccess(<function wraps at 0x1009e7bf8>)>
parent_context = <MixedObject: <module 'functools' from '/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/functools.py'>>, args = ()
result = (<Module: @1-837>, <Function: wraps@67-80>, FileIO(/Users/trevor/git/jedi/.tox/py37/bin/../lib/python3.7/functools.py)...in Python to be added\n', '# to the functools module.\n', '# Written by Nick Coghlan <ncoghlan at gmail.com>,\n', ...])

    @compiled_objects_cache('mixed_cache')
    def _create(evaluator, access_handle, parent_context, *args):
        compiled_object = create_cached_compiled_object(
            evaluator,
            access_handle,
            parent_context=parent_context and parent_context.compiled_object
        )

        result = _find_syntax_node_name(evaluator, access_handle)
        if result is None:
            # TODO Care about generics from stuff like `[1]` and don't return like this.
            python_object = access_handle.access._obj
            if type(python_object) in (dict, list, tuple):
                return ContextSet({compiled_object})

            tree_contexts = to_stub(compiled_object)
            if not tree_contexts:
                return ContextSet({compiled_object})
        else:
            module_node, tree_node, file_io, code_lines = result

            if parent_context is None:
                # TODO this __name__ is probably wrong.
                name = compiled_object.get_root_context().py__name__()
                string_names = tuple(name.split('.'))
                module_context = ModuleContext(
                    evaluator, module_node,
                    file_io=file_io,
                    string_names=string_names,
                    code_lines=code_lines,
                    is_package=hasattr(compiled_object, 'py__path__'),
                )
                if name is not None:
                    evaluator.module_cache.add(string_names, ContextSet([module_context]))
            else:
>               assert parent_context.tree_node.get_root_node() == module_node
E               AssertionError

jedi/evaluate/compiled/mixed.py:254: AssertionError
_____________________________________________________________________________________________________________ test_venv_and_pths _____________________________________________________________________________________________________________

venv_path = '/private/var/folders/dj/r2pgr6xs46sgs6xqfhh2dlc40000gn/T/pytest-of-trevor/pytest-1/venv'

    def test_venv_and_pths(venv_path):
        pjoin = os.path.join

        CUR_DIR = os.path.dirname(__file__)
        site_pkg_path = pjoin(venv_path, 'lib')
        if os.name == 'nt':
            site_pkg_path = pjoin(site_pkg_path, 'site-packages')
        else:
            site_pkg_path = glob(pjoin(site_pkg_path, 'python*', 'site-packages'))[0]
        shutil.rmtree(site_pkg_path)
        shutil.copytree(pjoin(CUR_DIR, 'sample_venvs', 'pth_directory'), site_pkg_path)

>       virtualenv = create_environment(venv_path)

test/test_evaluate/test_sys_path.py:44:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
jedi/api/environment.py:355: in create_environment
    return Environment(_get_executable_path(path, safe=safe))
jedi/api/environment.py:370: in _get_executable_path
    _assert_safe(python, safe)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

executable_path = '/private/var/folders/dj/r2pgr6xs46sgs6xqfhh2dlc40000gn/T/pytest-of-trevor/pytest-1/venv/bin/python', safe = True

    def _assert_safe(executable_path, safe):
        if safe and not _is_safe(executable_path):
            raise InvalidPythonEnvironment(
>               "The python binary is potentially unsafe.")
E           jedi.api.environment.InvalidPythonEnvironment: The python binary is potentially unsafe.

jedi/api/environment.py:404: InvalidPythonEnvironment
======================================================================================= 10 failed, 2073 passed, 32 skipped, 5 xfailed in 67.07 seconds =======================================================================================
ERROR: InvocationError for command /Users/trevor/git/jedi/.tox/py37/bin/pytest (exited with code 1)
@davidhalter

This comment has been minimized.

Copy link
Owner

commented Jun 12, 2019

@pcgeek86 No idea if those are actually issues. Especially the environment ones.

In general parso needs to be upgraded, because imports changed and other breaking changes, so without upgrading parso you shouldn't even be able to run anything in Jedi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.