1
0
forked from VimPlug/jedi

Merge pull request #1800 from Boerde/pytest_improve_fixture_completion

Improve completion for pytest fixtures
This commit is contained in:
Dave Halter
2021-11-16 21:09:35 +01:00
committed by GitHub
4 changed files with 15 additions and 1 deletions

View File

@@ -344,7 +344,8 @@ class BaseFunctionExecutionContext(ValueContext, TreeContextMixin):
GenericClass(c, TupleGenericManager(generics)) for c in async_classes
).execute_annotation()
else:
if self.is_generator():
# If there are annotations, prefer them over anything else.
if self.is_generator() and not self.infer_annotations():
return ValueSet([iterable.Generator(inference_state, self)])
else:
return self.get_return_values()

View File

@@ -43,6 +43,9 @@ def infer_anonymous_param(func):
return function_context.get_return_values()
def wrapper(param_name):
# parameters with an annotation do not need special handling
if param_name.annotation_node:
return func(param_name)
is_pytest_param, param_name_is_function_name = \
_is_a_pytest_param_and_inherited(param_name)
if is_pytest_param: