[Twisted-Python] Making non-blocking code blocking?

Jp Calderone exarkun at divmod.com
Fri Sep 3 18:19:15 EDT 2004

Paul Campbell wrote:
> Here's the situation...
> I've been writing all my code to defer correctly. Every time it gets to a point
> where the call can block, I've inserted the appropriate callback function.
> However, it occurred to me (for testing purposes) that it would
> be nice some times to INTENTIONALLY block.

   Trial exposes some utilities for this.  twisted.trial.util.wait() is 
the most useful of them.  It takes a Deferred.  It returns the result of 
the Deferred, or raises an exception if the Deferred fails.  It supports 
timeouts, and by default will fail after 10 seconds if no result arrives.


More information about the Twisted-Python mailing list