[Twisted-Python] Stopping Reactor in UnitTest Callback

Fabian Rothfuchs fabian.rothfuchs at googlemail.com
Thu Jan 24 07:34:45 MST 2013


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 SOAP
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 the
suds module. I now discovered that the server process started in `setUp()`
hangs as long as the suds connection did not finish.
Which is a deadlock, as it cannot finish unless the server sent the
response.

When trying to connect to the server via telnet, I do not get any response
unless the suds connection is lost.

Snippets:
TestCase: http://dpaste.org/pmg6Y/
TestServer: http://dpaste.org/NOLb8/
Client: http://dpaste.org/2wxIV/

Thanks for any help!
Fabian


From:  Fabian Rothfuchs <fabian.rothfuchs at googmail.com>
Date:  Thursday, January 17, 2013 11:27 AM
To:  Twisted general discussion <twisted-python at twistedmatrix.com>
Subject:  Re: [Twisted-Python] Stopping Reactor in UnitTest Callback

While trying to minimalize my code, I discovered that the following line
somewhere down deep the code is causing the whole test to hang:
> adbapi.ConnectionPool('MySQLdb', system.host, system.username,
> system.password, system.database)
> 
> 
It seems that the connection is not being closed properly, causing the whole
test chain to hang.


From:  Itamar Turner-Trauring <itamar at futurefoundries.com>
Reply-To:  Twisted general discussion <twisted-python at twistedmatrix.com>
Date:  Tuesday, January 15, 2013 6:22 PM
To:  Twisted general discussion <twisted-python at twistedmatrix.com>
Subject:  Re: [Twisted-Python] Stopping Reactor in UnitTest Callback



On Tue, Jan 15, 2013 at 10:26 AM, Fabian Rothfuchs
<fabian.rothfuchs at googlemail.com> wrote:
> Yes, I thought so, too. Indeed it happens that the reactor is started
> automatically, but after the test succeeds, it's not being stopped (only
> chance is to kill ­9 it).

Perhaps the problem isn't with the test framework, but with your test. Can
you show us a minimal piece of code that reproduces the problem?
_______________________________________________ Twisted-Python mailing list
Twisted-Python at twistedmatrix.comhttp://twistedmatrix.com/cgi-bin/mailman/lis
tinfo/twisted-python


-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20130124/fc3e0e50/attachment-0001.html>


More information about the Twisted-Python mailing list