Re: [Twisted-Python] Mimicking a blocking API using Twisted

2012-03-25 Thread Glyph
On Mar 25, 2012, at 9:27 PM, Paul Reznicek wrote: > I have similar needs and did not found usable answers, so I wrote some > q&d hacks for doctests and also for UI interactions, where the user should > be blocked until something in non-blocking deferred finish or "time-outed". These hacks are al

Re: [Twisted-Python] Mimicking a blocking API using Twisted

2012-03-25 Thread Paul Reznicek
Hello, I have similar needs and did not found usable answers, so I wrote some q&d hacks for doctests and also for UI interactions, where the user should be blocked until something in non-blocking deferred finish or "time-outed". Below hacks are working with twisted 10.0.0, no idea about more actua

Re: [Twisted-Python] Mimicking a blocking API using Twisted

2012-03-25 Thread Glyph
On Mar 25, 2012, at 8:03 PM, Itamar Turner-Trauring wrote: > 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 in

Re: [Twisted-Python] Mimicking a blocking API using Twisted

2012-03-25 Thread Itamar Turner-Trauring
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 i

Re: [Twisted-Python] Mimicking a blocking API using Twisted

2012-03-25 Thread Laurens Van Houtven
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 usua

Re: [Twisted-Python] Mimicking a blocking API using Twisted

2012-03-25 Thread Itamar Turner-Trauring
On 03/25/2012 05:02 PM, Laurens Van Houtven wrote: > Hi, > > > I'm trying to find out if there's a reasonable way to mimic a blocking > API with an existing non-blocking API. I want to do this so I can > write doctests. > > For example, I want to make a remote AMP call. It returns a deferred. >

[Twisted-Python] Mimicking a blocking API using Twisted

2012-03-25 Thread Laurens Van Houtven
Hi, I'm trying to find out if there's a reasonable way to mimic a blocking API with an existing non-blocking API. I want to do this so I can write doctests. For example, I want to make a remote AMP call. It returns a deferred. Instead of returning a deferred, I want it to block until the deferre