<br><br><div class="gmail_quote">On Mon, Jan 26, 2009 at 12:09 PM, Drew Smathers <span dir="ltr">&lt;<a href="mailto:drew.smathers@gmail.com">drew.smathers@gmail.com</a>&gt;</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 &lt;<a href="mailto:alessio.pace@gmail.com">alessio.pace@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I would like to put in my suite of tests some integration tests which deal<br>
&gt; with running some exchange of messages among 2 endpoints (bound locally on<br>
&gt; the same machine on 2 different ports).<br>
&gt;<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. &nbsp;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>
&gt; I noticed (and read afterwards..) that I can&#39;t run()/stop() the reactor<br>
&gt; multiple times, so I was wondering what&#39;s the suggested way to deal with<br>
&gt; this kind of situation.<br>
<br>
</div>You can close connections and reconnect etc. without &quot;restarting&quot; the<br>
reactor - so I don&#39;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&#39;m trying to understand how to do from the UDP test case in Twisted trunk..<br>
&nbsp;<br>Thanks. Regards,<br>Alessio Pace.<br></div></div><br>