From 155ffa07deda2f180fd891d3dd69b2a53f4b18ce Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 22 Jul 2009 14:50:17 +0200 Subject: [PATCH] applying samuele's patch fixing a regression resolves issue #26 --HG-- branch : 1.0.x --- py/test/plugin/pytest__pytest.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/py/test/plugin/pytest__pytest.py b/py/test/plugin/pytest__pytest.py index 489b4ab66..3cca095f3 100644 --- a/py/test/plugin/pytest__pytest.py +++ b/py/test/plugin/pytest__pytest.py @@ -57,7 +57,7 @@ class HookRecorder: def _makecallparser(self, method): name = method.__name__ args, varargs, varkw, default = py.std.inspect.getargspec(method) - if args and args[0] != "self": + if not args or args[0] != "self": args.insert(0, 'self') fspec = py.std.inspect.formatargspec(args, varargs, varkw, default) # we use exec because we want to have early type @@ -113,6 +113,19 @@ def test_hookrecorder_basic(): assert call._name == "xyz" py.test.raises(ValueError, "rec.popcall('abc')") +def test_hookrecorder_basic_no_args_hook(): + import sys + comregistry = py._com.Registry() + rec = HookRecorder(comregistry) + apimod = type(sys)('api') + def xyz(): + pass + apimod.xyz = xyz + rec.start_recording(apimod) + rec.hook.xyz() + call = rec.popcall("xyz") + assert call._name == "xyz" + reg = py._com.comregistry def test_functional_default(testdir, _pytest): assert _pytest.comregistry == py._com.comregistry