introduce a new subset_hook_caller instead of remove make_hook_caller

and adapat and refine conftest/global plugin management accordingly

--HG--
branch : more_plugin
This commit is contained in:
holger krekel
2015-04-26 00:10:52 +02:00
parent d422247433
commit 32165d82b1
4 changed files with 68 additions and 75 deletions

View File

@@ -176,25 +176,6 @@ class TestPluginManager:
l = pm.hook.he_method1.call_extra([he_method1], dict(arg=1))
assert l == [10]
def test_make_hook_caller_unregistered(self, pm):
class Hooks:
def he_method1(self, arg):
pass
pm.addhooks(Hooks)
l = []
class Plugin:
def he_method1(self, arg):
l.append(arg * 10)
plugin = Plugin()
pm.register(plugin)
hc = pm.make_hook_caller("he_method1", [plugin])
hc(arg=1)
assert l == [10]
pm.unregister(plugin)
hc(arg=2)
assert l == [10]
def test_subset_hook_caller(self, pm):
class Hooks:
def he_method1(self, arg):
@@ -232,6 +213,11 @@ class TestPluginManager:
pm.unregister(plugin1)
hc(arg=2)
assert l == []
l[:] = []
pm.hook.he_method1(arg=1)
assert l == [10]
class TestAddMethodOrdering: