[Twisted-Python] Using a custom reactor in twisted trial for test cases?
andrewfr_ice at yahoo.com
Fri Oct 30 13:12:48 EDT 2009
Date: Fri, 30 Oct 2009 17:38:12 +0800
From: Crispin Wellington <cwellington at ccg.murdoch.edu.au>
Subject: [Twisted-Python] Using a custom reactor in twisted trial for
To: twisted-python at twistedmatrix.com
Message-ID: <1256895492.4200.9.camel at wolfwood>
>I am using twisted trial to run test cases for an application. The
>application however uses stackless python and has a custom stackless
>reactor. I implemented this reactor like this...
For better or worse, much of what you have discussed have been fleshed out about two years ago in this mailing list and in stackless. Also I outline strategies in the PyCon 2008 talk "Adventures in Stackless Twisted Integration." Personally, I don't know why more people don't use Stackless with Twisted.
1) Based on what I have seen, you don't need to write a custom reactor (I still remember Glyph setting me straight on that one). At least for what you are doing :-).
2) Use task.loopingCall to make the reactor periodically yield.
l = task.LoopingCall(stackless.schedule)
however there is some weird interaction between Stackless Python 2.6 and Twisted so you may have to do
or play with the recursionlimit variable. I have not gotten to the bottom of that problem.
More information about the Twisted-Python