<br><br><div class="gmail_quote">On Mon, Jan 26, 2009 at 12:09 PM, Drew Smathers <span dir="ltr"><<a href="mailto:drew.smathers@gmail.com">drew.smathers@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Mon, Jan 26, 2009 at 4:02 PM, Alessio Pace <<a href="mailto:alessio.pace@gmail.com">alessio.pace@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I would like to put in my suite of tests some integration tests which deal<br>
> with running some exchange of messages among 2 endpoints (bound locally on<br>
> the same machine on 2 different ports).<br>
><br>
<br>
</div>Trial allows you to return a Deferred, which in you case is something<br>
you would call after your endpoints close their connections. You can<br>
grep through twisted sources though to see how this can be done<br>
without network connections in unit tests - look for test cases using<br>
the module simio.<br>
<div class="Ih2E3d"><br>
> I noticed (and read afterwards..) that I can't run()/stop() the reactor<br>
> multiple times, so I was wondering what's the suggested way to deal with<br>
> this kind of situation.<br>
<br>
</div>You can close connections and reconnect etc. without "restarting" the<br>
reactor - so I don't see how this is an obstacle.</blockquote><div><br>The point is that I must assure multiple test classes have their test methods run within an active reactor. So somewhere a reactor.run() has to be called.. Necessarily, if I want that my tests battery to terminate, a reactor.stop() must be invoked by somebody, otherwise the main loop remains running...<br>
<br>The trivial -and not working- idea was to do reactor.run() / reactor.stop() in setUp() / tearDown() methods.<br><br>I believe extening Trial TestCase is the good way to go, but as you are mentioning, there is not so much documentation... I'm trying to understand how to do from the UDP test case in Twisted trunk..<br>
<br>Thanks. Regards,<br>Alessio Pace.<br></div></div><br>