Make goto work for pytest fixtures
This commit is contained in:
1 parent
5a54d94aa5
commit
8c737ba17e
2 files changed
+17
-4
No files matched your search
+13
-4
@@ -31,16 +31,25 @@ def infer_anonymous_param(func):
|
||||
else:
|
||||
return function_context.get_return_values()
|
||||
|
||||
def wrapper(param):
|
||||
module = param.get_root_context()
|
||||
fixtures = _goto_pytest_fixture(module, param.string_name)
|
||||
def wrapper(param_name):
|
||||
module = param_name.get_root_context()
|
||||
fixtures = _goto_pytest_fixture(module, param_name.string_name)
|
||||
if fixtures:
|
||||
return ValueSet.from_sets(
|
||||
get_returns(value)
|
||||
for fixture in fixtures
|
||||
for value in fixture.infer()
|
||||
)
|
||||
return func(param)
|
||||
return func(param_name)
|
||||
return wrapper
|
||||
|
||||
|
||||
def goto_anonymous_param(func):
|
||||
def wrapper(param_name):
|
||||
names = _goto_pytest_fixture(param_name.get_root_context(), param_name.string_name)
|
||||
if names:
|
||||
return names
|
||||
return func(param_name)
|
||||
return wrapper
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user