[Twisted-Python] testing for error conditions

gary jefferson garyjefferson123 at gmail.com
Fri Feb 2 00:43:48 EST 2007

I've got a little test program that checks to make sure my protocol
behaves correctly.  Each function returns a deferred, and sets the
next function as the callback, and some common function as errback.
This seems to work great -- the test runs through all the test funcs
when working properly, and halts at the problem point if not.

But now I want to verify that I get errors (errbacks) in all the
places I should.  I was hoping to do the same thing as before, only
now swap the function of the errbacks with that of the callbacks.

This doesn't seem to work.  Returning a deferred from an errback still
results in its parent errbacks getting called, terminating the test
program prematurely.

Whats the right way to test conditions that should trigger errbacks?
I couldn't see a tutorial or doc that covered this.


More information about the Twisted-Python mailing list