forked from VimPlug/jedi
Make sure the monkeypatch fixture completion works
This commit is contained in:
@@ -5,6 +5,10 @@ from jedi.inference.imports import load_module_from_path
|
||||
from jedi.inference.filters import ParserTreeFilter
|
||||
from jedi.inference.base_value import NO_VALUES, ValueSet
|
||||
|
||||
_PYTEST_FIXTURE_MODULES = [
|
||||
('_pytest', 'monkeypatch')
|
||||
]
|
||||
|
||||
|
||||
def execute(callback):
|
||||
def wrapper(value, arguments):
|
||||
@@ -110,6 +114,10 @@ def _iter_pytest_modules(module_context):
|
||||
pass
|
||||
folder = folder.get_parent_folder()
|
||||
|
||||
for names in _PYTEST_FIXTURE_MODULES:
|
||||
for module_value in module_context.inference_state.import_module(names):
|
||||
yield module_value.as_context()
|
||||
|
||||
|
||||
class FixtureFilter(ParserTreeFilter):
|
||||
def _filter(self, names):
|
||||
|
||||
@@ -116,3 +116,16 @@ def lala(my_con
|
||||
#? 15 ['my_conftest_fixture']
|
||||
def lala(my_con):
|
||||
return
|
||||
|
||||
# -----------------
|
||||
# pytest owned fixtures
|
||||
# -----------------
|
||||
|
||||
#? ['monkeypatch']
|
||||
def test_p(monkeyp
|
||||
|
||||
|
||||
#! 15 ['def monkeypatch']
|
||||
def test_p(monkeypatch):
|
||||
#? ['setattr']
|
||||
monkeypatch.setatt
|
||||
|
||||
Reference in New Issue
Block a user