Skip to content

Commit f087c1e

Browse files
author
Tyler Goodlet
committed
Add a test which verifies firstresult wrappers
This is to expose the regression from issue #71. Wrappers must return a single value not a list.
1 parent 557cd3f commit f087c1e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

testing/test_hookrelay.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,17 @@ class Plugin3(object):
8787
def hello(self, arg):
8888
return None
8989

90+
class Plugin4(object):
91+
@hookimpl(hookwrapper=True)
92+
def hello(self, arg):
93+
assert arg == 3
94+
outcome = yield
95+
assert outcome.get_result() == 2
96+
9097
pm.register(Plugin1()) # discarded - not the last registered plugin
9198
pm.register(Plugin2()) # used as result
9299
pm.register(Plugin3()) # None result is ignored
100+
pm.register(Plugin4()) # hookwrapper should get same non-list result
93101
res = pm.hook.hello(arg=3)
94102
assert res == 2
95103

0 commit comments

Comments
 (0)