[Twisted-Python] Re: Hanging test cases (Was: Evangelism notes...)
Christopher Armstrong
radeex at gmail.com
Sat May 7 21:37:10 EDT 2005
On 06 May 2005 20:19:45 -0400, David Bolen <db3l at fitlinxx.com> wrote:
> Bob Ippolito <bob at redivi.com> writes:
> > > self.user = deferredResult(self.umgr.user())
> > > self.user.email = 'test at dom.ain'
> > > deferredResult(self.umgr.saveUser(self.user))
> >
> > # let's assume I've aliased waitForDeferred to "wait"
> >
> > d = waitForDeferred(self.umgr.user())
> > yield d
> > self.user = d.getResult()
> > self.user.email = 'test at dom.ain'
> > d = waitForDeferred(self.umgr.saveUser(self.user))
> > yield d
> > d.getResult()
> >
> > So, the test is 6 lines instead of 3. Which sucks, but it's correct.
> > For tests that do more stuff, it probably should be even less of a
> > problem.
>
> Except that you didn't include the additional code I'd now have to
> write to actually turn that into a generator which is iterated over by
> the test in order to actually process the deferrable yields. (Unless
> this is something trial does automatically somehow).
Uhhh, maybe I'm missing something here, but as I understand it (I
probably should, being the guy who wrote deferredgenerators), that
code is:
testCase = deferredGenerator(testCase)
after the definition of the method, or even:
@deferredGenerator
before the definition of the method.
HTH
--
Twisted | Christopher Armstrong: International Man of Twistery
Radix | -- http://radix.twistedmatrix.com
| Release Manager, Twisted Project
\\\V/// | -- http://twistedmatrix.com
|o O| | Founding Member, Hobart Hacking Society
w----v----w-+ -- http://hackingsociety.org/chapters/hash
More information about the Twisted-Python
mailing list