diff --git a/testing/test_hookrelay.py b/testing/test_hookrelay.py index 38c5e2ad..0d4da94c 100644 --- a/testing/test_hookrelay.py +++ b/testing/test_hookrelay.py @@ -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 diff --git a/testing/test_method_ordering.py b/testing/test_method_ordering.py index 7c87702a..562fa706 100644 --- a/testing/test_method_ordering.py +++ b/testing/test_method_ordering.py @@ -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")