rewrite nose-optional-call check, fixes python2.4 compat

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-10-29 18:08:05 +01:00
parent 7aee121bd7
commit c02719f44c
1 changed files with 3 additions and 4 deletions

View File

@ -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