forked from VimPlug/jedi
Add a test to check if numpy tensorflow stuff is now cached, see #1116
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from itertools import count
|
||||
|
||||
import pytest
|
||||
|
||||
from . import helpers
|
||||
from . import run
|
||||
from . import refactor
|
||||
|
||||
import jedi
|
||||
from jedi.api.environment import InterpreterEnvironment
|
||||
from jedi.inference.compiled.value import create_from_access_path
|
||||
from jedi.inference.imports import _load_python_module
|
||||
from jedi.file_io import KnownContentFileIO
|
||||
from jedi.inference.base_value import ValueSet
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
@@ -144,3 +145,16 @@ def create_compiled_object(inference_state):
|
||||
inference_state,
|
||||
inference_state.compiled_subprocess.create_simple_object(obj)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def module_injector():
|
||||
counter = count()
|
||||
|
||||
def module_injector(inference_state, names, code):
|
||||
assert isinstance(names, tuple)
|
||||
file_io = KnownContentFileIO('/foo/bar/module-injector-%s.py' % next(counter), code)
|
||||
v = _load_python_module(inference_state, file_io, names)
|
||||
inference_state.module_cache.add(names, ValueSet([v]))
|
||||
|
||||
return module_injector
|
||||
|
||||
Reference in New Issue
Block a user