Reputation: 151
I'm trying to make a end to end connection test using Trial. For this purpose I created a mockserver which implements the generic methods, connectionMade and connectionLost.
For the client-side I reused the real modules because I wanna test their operation.The problem comes when I try to established a connection.
It only works when I run the reactor.run method which I know can't be used.
How twisted handles the test reactor? I mean, it's only needed run the reactor.listen method, from the server-side, and the reactor.connect method from the client-side for established a connection?
Upvotes: 0
Views: 109
Reputation: 31860
You need to return a Deferred
from your test_
method, which is what tells the reactor to run - firing that Deferred
then tells the reactor to stop.
https://twistedmatrix.com/documents/15.0.0/core/howto/trial.html explains how to do this.
Upvotes: 1