[py-svn] py-trunk commit 988b3400b47e: nose plugin wont call setup functions that arent made for it

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Oct 27 16:52:33 CET 2009


# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview/
# User Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
# Date 1256307388 -7200
# Node ID 988b3400b47e55cd1fb5e2b3afaa4462831cf51f
# Parent 61a03e7e72248ee42f29cbceea1aad052c62362b
nose plugin wont call setup functions that arent made for it

--- a/_py/test/plugin/pytest_nose.py
+++ b/_py/test/plugin/pytest_nose.py
@@ -85,7 +85,9 @@ def pytest_make_collect_report(collector
 def call_optional(obj, name):
     method = getattr(obj, name, None)
     if method:
-        method()
-        return True
-    else:
-        return False
+        argspec = inspect.getargspec(method)
+        if argspec[0] == ['self']:
+            argspec = argspec[1:]
+        if not any(argspec):
+            method()
+            return True



More information about the pytest-commit mailing list