mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Fix a small pytest fixture bug
This commit is contained in:
@@ -107,16 +107,18 @@ def _is_pytest_func(func_name, decorator_nodes):
|
|||||||
def _iter_pytest_modules(module_context):
|
def _iter_pytest_modules(module_context):
|
||||||
yield module_context
|
yield module_context
|
||||||
|
|
||||||
folder = module_context.get_value().file_io.get_parent_folder()
|
file_io = module_context.get_value().file_io
|
||||||
sys_path = module_context.inference_state.get_sys_path()
|
if file_io is not None:
|
||||||
while any(folder.path.startswith(p) for p in sys_path):
|
folder = file_io.get_parent_folder()
|
||||||
file_io = folder.get_file_io('conftest.py')
|
sys_path = module_context.inference_state.get_sys_path()
|
||||||
try:
|
while any(folder.path.startswith(p) for p in sys_path):
|
||||||
m = load_module_from_path(module_context.inference_state, file_io)
|
file_io = folder.get_file_io('conftest.py')
|
||||||
yield m.as_context()
|
try:
|
||||||
except FileNotFoundError:
|
m = load_module_from_path(module_context.inference_state, file_io)
|
||||||
pass
|
yield m.as_context()
|
||||||
folder = folder.get_parent_folder()
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
folder = folder.get_parent_folder()
|
||||||
|
|
||||||
for names in _PYTEST_FIXTURE_MODULES:
|
for names in _PYTEST_FIXTURE_MODULES:
|
||||||
for module_value in module_context.inference_state.import_module(names):
|
for module_value in module_context.inference_state.import_module(names):
|
||||||
|
|||||||
Reference in New Issue
Block a user