[Twisted-Python] Testing Twisted code without trial

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Mon Jan 21 19:21:32 EST 2013

On 20 Jan, 02:35 pm, adi at roiban.ro wrote:
>I start my pet project using Python Nose as test runner. At the start,
>Twisted not used at all.
>Later I discovered Twisted and start using it... but testing Twisted
>requires trial.
>I resist migrating to Trial and ended up with a custom code for
>running Twisted tests together with Nose:
>I though I can share this code on the list, in case there is someone
>else wrestling with deferres testing outside of Trial.
>Any feedback or comments is much appreciated.

The implementation is somewhat saddening in its use of Twisted internals 
(which makes it fragile and subject to easy breakage by new Twisted 
releases) and limited platform support (it won't work on Windows, 

You may also find problems with direct use of `reactor.iterate`, since 
use of this API is highly discouraged due to re-entrancy issues and its 
implementation is not all that well tested by Twisted's own test suite.

If it works for you, great, but I would hesitate to recommend it to new 
projects as a testing tool.  As Itamar suggests, nose should be able to 
run xUnit-style tests.


More information about the Twisted-Python mailing list