[Twisted-Python] Testing Twisted code without trial
adi at roiban.ro
Tue Mar 26 08:09:27 EDT 2013
On 26 March 2013 13:40, Itamar Turner-Trauring <itamar at itamarst.org> wrote:
> On 03/26/2013 06:39 AM, Adi Roiban wrote:
>> I am "spining" the reactor to "resolve" all deferreds involved in a
>> StringTransport conversation or in an DeferredList or other kind of
>> chained deferreds. These are what I call "integration tests" and they
>> only use memory, no external I/O.
> If you're only using StringTransport or Clock, there is no need for a
> real reactor. Deferreds have nothing to do with the reactor as such.
>> In most of my calles of result = self.getDeferredResult(deferred), the
>> deferred's callback() method was already called and I just want to
>> resolve the callbacks chain.
> Again, that does not require the reactor. E.g.:
> >>> d = Deferred()
> >>> d.callback(1)
> >>> l = 
> >>> d.addCallback(l.append)
> >>> l
> You might also want to look at the latest version of
> http://twistedmatrix.com/documents/current/core/howto/trial.html, in
> particular the new successResultOf and similar APIs.
Many thanks for you comment. I am stupid :) and successResultOf is great!
More information about the Twisted-Python