Skip to content

Commit d53ff72

Browse files
Merge pull request #62 from tgoodlet/drop_duplicate_test
Remove duplicate 'firstresult' test
2 parents b4506ff + 20c352c commit d53ff72

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

testing/test_hookrelay.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,23 @@ def hello(self, arg):
7272

7373
pm.add_hookspecs(Api)
7474

75-
class Plugin(object):
75+
class Plugin1(object):
7676
@hookimpl
7777
def hello(self, arg):
7878
return arg + 1
7979

80-
pm.register(Plugin())
80+
class Plugin2(object):
81+
@hookimpl
82+
def hello(self, arg):
83+
return arg - 1
84+
85+
class Plugin3(object):
86+
@hookimpl
87+
def hello(self, arg):
88+
return None
89+
90+
pm.register(Plugin1()) # discarded - not the last registered plugin
91+
pm.register(Plugin2()) # used as result
92+
pm.register(Plugin3()) # None result is ignored
8193
res = pm.hook.hello(arg=3)
82-
assert res == 4
94+
assert res == 2

testing/test_method_ordering.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -180,24 +180,6 @@ def he_myhook1(arg1):
180180
assert not hasattr(he_myhook1, name)
181181

182182

183-
def test_decorator_functional(pm):
184-
class HookSpec(object):
185-
@hookspec(firstresult=True)
186-
def he_myhook(self, arg1):
187-
""" add to arg1 """
188-
189-
pm.add_hookspecs(HookSpec)
190-
191-
class Plugin(object):
192-
@hookimpl()
193-
def he_myhook(self, arg1):
194-
return arg1 + 1
195-
196-
pm.register(Plugin())
197-
results = pm.hook.he_myhook(arg1=17)
198-
assert results == 18
199-
200-
201183
def test_load_setuptools_instantiation(monkeypatch, pm):
202184
pkg_resources = pytest.importorskip("pkg_resources")
203185

0 commit comments

Comments
 (0)