diff --git a/py/_test/pluginmanager.py b/py/_test/pluginmanager.py
index <HASH>..<HASH> 100644
--- a/py/_test/pluginmanager.py
+++ b/py/_test/pluginmanager.py
@@ -259,6 +259,8 @@ class MultiCall:
         return kwargs
 
 def varnames(func):
+    if not inspect.isfunction(func) and not inspect.ismethod(func):
+        func = getattr(func, '__call__', func)
     ismethod = inspect.ismethod(func)
     rawcode = py.code.getrawcode(func)
     try:
diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py
index <HASH>..<HASH> 100644
--- a/testing/test_pluginmanager.py
+++ b/testing/test_pluginmanager.py
@@ -340,8 +340,12 @@ def test_varnames():
     class A:
         def f(self, y):
             pass
+    class B(object):
+        def __call__(self, z):
+            pass
     assert varnames(f) == ("x",)
     assert varnames(A().f) == ('y',)
+    assert varnames(B()) == ('z',)
 
 class TestMultiCall:
     def test_uses_copy_of_methods(self):
patch from flub to allow callable objects as hook implementations

--HG--
branch : trunk