mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
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.filters import ParserTreeFilter
|
||||||
from jedi.inference.base_value import NO_VALUES, ValueSet
|
from jedi.inference.base_value import NO_VALUES, ValueSet
|
||||||
|
|
||||||
|
_PYTEST_FIXTURE_MODULES = [
|
||||||
|
('_pytest', 'monkeypatch')
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def execute(callback):
|
def execute(callback):
|
||||||
def wrapper(value, arguments):
|
def wrapper(value, arguments):
|
||||||
@@ -110,6 +114,10 @@ def _iter_pytest_modules(module_context):
|
|||||||
pass
|
pass
|
||||||
folder = folder.get_parent_folder()
|
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):
|
class FixtureFilter(ParserTreeFilter):
|
||||||
def _filter(self, names):
|
def _filter(self, names):
|
||||||
|
|||||||
@@ -116,3 +116,16 @@ def lala(my_con
|
|||||||
#? 15 ['my_conftest_fixture']
|
#? 15 ['my_conftest_fixture']
|
||||||
def lala(my_con):
|
def lala(my_con):
|
||||||
return
|
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