Skip to content

Assertion rewriting breaks jedi due to missing InspectLoader support #6643

Open
@iwanb

Description

@iwanb

platform linux -- Python 3.7.6, pytest-5.3.4, py-1.6.0, pluggy-0.12.0

I am using IPython with jedi completions within a pytest session. Assertion rewriting is enabled, but doing completions on rewritten modules crashes jedi because mod.__loader__.is_package is not implemented.
https://docs.python.org/3/library/importlib.html#importlib.abc.InspectLoader

AFAIK is would be best if the importer subclass those:
https://docs.python.org/3/library/importlib.html#importlib.abc.FileLoader
https://docs.python.org/3/library/importlib.html#importlib.abc.SourceLoader

To get all the methods implemented.

See the trace at davidhalter/jedi#1487

This is probably related to #3919 where is_package was removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: rewriterelated to the assertion rewrite mechanism

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions