rewrite nose-optional-call check, fixes python2.4 compat
--HG-- branch : trunk
This commit is contained in:
parent
7aee121bd7
commit
c02719f44c
|
@ -91,9 +91,8 @@ def pytest_make_collect_report(collector):
|
|||
def call_optional(obj, name):
|
||||
method = getattr(obj, name, None)
|
||||
if method:
|
||||
argspec = inspect.getargspec(method)
|
||||
if argspec[0] == ['self']:
|
||||
argspec = argspec[1:]
|
||||
if not any(argspec):
|
||||
ismethod = inspect.ismethod(method)
|
||||
rawcode = py.code.getrawcode(method)
|
||||
if not rawcode.co_varnames[ismethod:]:
|
||||
method()
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue