[Twisted-Python] Stopping Reactor in UnitTest Callback

Fabian Rothfuchs fabian.rothfuchs at googlemail.com
Fri Jan 25 04:15:07 EST 2013

Hey Jean-Paul (and all the others in this thread),

Thank you very much for your help so far - I do really appreciate it!

I'm well aware of the fact that `deferLater` does not magically turn
blocking apps to non-blocking ones.
The idea is, whatever SUDS does, in the end it should send a SOAP request
to my
My problem is, that SUDS indeed sends the request, but wants to get an
immediate response, which causes a deadlock.

I just came across the very same question asked a couple of years ago:

This should help me out of this.


On 1/24/13 5:00 PM, "exarkun at twistedmatrix.com"
<exarkun at twistedmatrix.com> wrote:

>On 02:34 pm, fabian.rothfuchs at googlemail.com wrote:
>>Hey again!
>>Having the setup doing quite well so far, I just ran into a problem
>>that I
>>do not know how to debug:
>>Testcase `setUp()` starts a server that subclasses
>>`twisted.web.resource.Resource` , as it's going to be a lightweight
>>server, responding with hard-coded xml strings.
>>Purpose is to check the request for validity.
>>The Testcase's `test_*()` function initiates a client request by using
>>suds module. I now discovered that the server process started in
>>hangs as long as the suds connection did not finish.
>It looks like you're using `deferLater` as though it turns the SUDS
>client from a blocking, synchronous API into a non-blocking,
>asynchronous API.  This is not what `deferLater` does.  `deferLater`
>just schedules a function call to happen at a later time.
>Your SUDS *client* is blocking the process from doing anything.  You
>need a non-blocking, asynchronous SUDS client.  You could use SUDS in a
>thread (if it is thread-safe) or you could find a different client.
>>Which is a deadlock, as it cannot finish unless the server sent the
>>When trying to connect to the server via telnet, I do not get any
>>unless the suds connection is lost.
>>TestCase: http://dpaste.org/pmg6Y/
>>TestServer: http://dpaste.org/NOLb8/
>>Client: http://dpaste.org/2wxIV/
>>Thanks for any help!
>Twisted-Python mailing list
>Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list