simplify _scan_plugin implementation and store argnames on HookCaller

This commit is contained in:
holger krekel
2014-10-01 13:57:35 +02:00
parent 351931d5ca
commit e635f9f9b2
2 changed files with 50 additions and 54 deletions

View File

@@ -630,6 +630,18 @@ class TestHookRelay:
assert l == [4]
assert not hasattr(mcm, 'world')
def test_argmismatch(self):
class Api:
def hello(self, arg):
"api hook 1"
pm = PluginManager(Api, prefix="he")
class Plugin:
def hello(self, argwrong):
return arg + 1
with pytest.raises(PluginValidationError) as exc:
pm.register(Plugin())
assert "argwrong" in str(exc.value)
def test_only_kwargs(self):
pm = PluginManager()
class Api: