[Twisted-Python] Mimicking a blocking API using Twisted

Itamar Turner-Trauring itamar at itamarst.org
Sun Mar 25 20:03:02 EDT 2012

On 03/25/2012 07:54 PM, Laurens Van Houtven wrote:
> The thing I'm documenting is a server, I'm documenting it by interacting with it as a client. I realize that doesn't entirely detract from your point -- you might still be introducing problems that would not affect a "real" client.
> My intention is to write BDD-ish stuff (except not with the usual cucumber-style scenario text).

This might be workable if the protocol is synchronous: send request, get 
back response. This wouldn't work e.g. for a chat protocol. I bet you 
could do something horrible where the doctest gets wrapped in an 
inlineCallbacks wrapper, and then you can yield Deferreds.

More information about the Twisted-Python mailing list