applying samuele's patch fixing a regression
resolves issue #26 --HG-- branch : 1.0.x
This commit is contained in:
parent
6216ab2bb7
commit
155ffa07de
|
@ -57,7 +57,7 @@ class HookRecorder:
|
||||||
def _makecallparser(self, method):
|
def _makecallparser(self, method):
|
||||||
name = method.__name__
|
name = method.__name__
|
||||||
args, varargs, varkw, default = py.std.inspect.getargspec(method)
|
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')
|
args.insert(0, 'self')
|
||||||
fspec = py.std.inspect.formatargspec(args, varargs, varkw, default)
|
fspec = py.std.inspect.formatargspec(args, varargs, varkw, default)
|
||||||
# we use exec because we want to have early type
|
# we use exec because we want to have early type
|
||||||
|
@ -113,6 +113,19 @@ def test_hookrecorder_basic():
|
||||||
assert call._name == "xyz"
|
assert call._name == "xyz"
|
||||||
py.test.raises(ValueError, "rec.popcall('abc')")
|
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
|
reg = py._com.comregistry
|
||||||
def test_functional_default(testdir, _pytest):
|
def test_functional_default(testdir, _pytest):
|
||||||
assert _pytest.comregistry == py._com.comregistry
|
assert _pytest.comregistry == py._com.comregistry
|
||||||
|
|
Loading…
Reference in New Issue