Added a test and fix for nose compatible setup/teardown functions that are partials, and so errors are not ignored

--HG--
branch : trunk
This commit is contained in:
Ed Singleton
2010-09-03 11:27:47 +01:00
parent b690290c3f
commit f814cb5346
2 changed files with 63 additions and 6 deletions
+5 -6
View File
@@ -90,9 +90,8 @@ def pytest_make_collect_report(collector):
def call_optional(obj, name):
method = getattr(obj, name, None)
if method:
ismethod = inspect.ismethod(method)
rawcode = py.code.getrawcode(method)
if not rawcode.co_varnames[ismethod:rawcode.co_argcount]:
method()
return True
if method and callable(method):
# If there's any problems allow the exception to raise rather than
# silently ignoring them
method()
return True