Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions testing/test_hookrelay.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,23 @@ def hello(self, arg):

pm.add_hookspecs(Api)

class Plugin(object):
class Plugin1(object):
@hookimpl
def hello(self, arg):
return arg + 1

pm.register(Plugin())
class Plugin2(object):
@hookimpl
def hello(self, arg):
return arg - 1

class Plugin3(object):
@hookimpl
def hello(self, arg):
return None

pm.register(Plugin1()) # discarded - not the last registered plugin
pm.register(Plugin2()) # used as result
pm.register(Plugin3()) # None result is ignored
res = pm.hook.hello(arg=3)
assert res == 4
assert res == 2
18 changes: 0 additions & 18 deletions testing/test_method_ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,24 +180,6 @@ def he_myhook1(arg1):
assert not hasattr(he_myhook1, name)


def test_decorator_functional(pm):
class HookSpec(object):
@hookspec(firstresult=True)
def he_myhook(self, arg1):
""" add to arg1 """

pm.add_hookspecs(HookSpec)

class Plugin(object):
@hookimpl()
def he_myhook(self, arg1):
return arg1 + 1

pm.register(Plugin())
results = pm.hook.he_myhook(arg1=17)
assert results == 18


def test_load_setuptools_instantiation(monkeypatch, pm):
pkg_resources = pytest.importorskip("pkg_resources")

Expand Down