[Twisted-Python] Running twisted.trial unittests using nose

Chris Miles miles.chris at gmail.com
Mon Aug 6 08:17:44 EDT 2007

I'm testing one of my modules that returns a Twisted deferred, using  
twisted.trial.unittest.TestCase.  The test case methods return a  
deferred, after first adding a callback to a function that actually  
performs the assertion.  All fairly standard for Twisted unit testing.

If I use "trial" to kick off the tests they all pass fine (or fail as  
expected, if I force them to).

If I run the same tests using "nosetests" they also pass (or fail  
correctly - which confirms the callbacks are being called properly).

I'm simply curious as to whether it is safe for me to rely on a test  
runner other than "trial" to run the tests?  I assume any magic  
(knowledge of deferreds) is within the  
twisted.trial.unittest.TestCase class and the "trial" command is  
simply another tool to discover and pretty print the results.  From  
what I've seen, both "nosetests" and "trial" will produce the same  
report (although "trial" looks nicer :-).  Or perhaps this wouldn't  
be the case if I needed to interact with the reactor?

Chris Miles

More information about the Twisted-Python mailing list