[Twisted-Python] Unit test

Jp Calderone exarkun at intarweb.us
Sun Nov 23 21:49:38 EST 2003

On Sun, Nov 23, 2003 at 11:29:45PM -0300, RITA Y/O RODRIGO DIAZ Y/O BENENSON wrote:
> Short question,
> which is the adecuate way of doing unit test of a sequence of defered
> events ? one chained to the other.
> If each deferred need a callback method, I have already more that thirty
> functiones defined, and each time I need more.
> How to do it ?
> defered = something
> <the magic>
> defered = the_next_thing # that need the previous defered to have been acomplished
> etc...
> I can imagine various tricks, but I supose there is a standart way. 

    from twisted.trial import unittest

    result = unittest.deferredResult(theDeferred)

  "deferredResult" iterates the reactor until the given deferred has a
result, then returns that result.

  See its sibling, deferredError, for testing of failure conditions.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20031123/669d7d12/attachment.pgp 

More information about the Twisted-Python mailing list