From 3a9d2873b508e8daaa98e885e5cbdf2f436a7cd2 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Fri, 17 Apr 2009 19:33:38 +0200 Subject: [PATCH] more or less fixes #4 along with changeset e07b15140498 note that i don't understand why the twisted plugin went through the "wrapper" function. seems to work just fine for me without it. also added the "True" return value which indicates we handled the call. however, the plugin hook will need some refinments. see XXXs. --HG-- branch : trunk --- contrib/pytest_twisted/__init__.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/contrib/pytest_twisted/__init__.py b/contrib/pytest_twisted/__init__.py index c1fd145a8..29ce0c5b8 100644 --- a/contrib/pytest_twisted/__init__.py +++ b/contrib/pytest_twisted/__init__.py @@ -100,18 +100,13 @@ class TwistedPlugin: def pytest_pyfunc_call(self, pyfuncitem, *args, **kwargs): if self.twisted: - def wrapper(func): - """ - wrapper just to pass back (injecting) the test-function into - doit() by using a greenlet switch. - """ - if hasattr(func, 'obj'): - # XXX: what about **kwargs? - res = gr_twisted.switch(lambda: func.obj(*args)) - if res: - res.raiseException() - pyfuncitem = wrapper(pyfuncitem) - + # XXX1 kwargs? + # XXX2 we want to delegate actual call to next plugin + # (which may want to produce test coverage, etc.) + res = gr_twisted.switch(lambda: pyfuncitem.obj(*args)) + if res: + res.raiseException() + return True # indicates that we performed the function call gr_twisted = greenlet(_run_twisted) gr_tests = greenlet.getcurrent()