<br><br><div class="gmail_quote">On Sat, Jan 12, 2013 at 9:00 AM, Fabian Rothfuchs <span dir="ltr">&lt;<a href="mailto:fabian.rothfuchs@googlemail.com" target="_blank">fabian.rothfuchs@googlemail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I&#39;m in the dilemma of using both - Django and Twisted.<br>
My goal is to have Django initialising the test (python manage.py test<br>
&lt;appname&gt;), instead of trial, as it will setup the whole test environment<br>
(I.e. Creates a db copy, allows per-model testing, follows certain<br>
conventions, etc).<br>
<br>
As to that I&#39;m trying to find a way how to start/stop the reactor from the<br>
test, as trial is not executed.<br>
Do you have an idea or an approach how this could be realised?<br></blockquote><div><br></div><div>The functionality to start/stop the reactor when a test returns a Deferred is part of twisted.trial.unittest.TestCase, which subclasses Python&#39;s unittest.TestCase. As a result you don&#39;t need to use the trial command-line tool, you can use any Python test runner that knows about Python&#39;s TestCase; just make sure to subclass twisted.trial.unittest.TestCase, and your test will support running the reactor for you when you return a Deferred. </div>
<div><br></div><div>Or, if possible, you can avoid using the reactor at all; some approaches (as mentioned by Jean-Paul) are described in the trial documentation: <a href="http://twistedmatrix.com/documents/current/core/howto/trial.html">http://twistedmatrix.com/documents/current/core/howto/trial.html</a></div>
</div><div><br></div>-- <br>Itamar Turner-Trauring, Future Foundries LLC<br><a href="http://futurefoundries.com/" target="_blank">http://futurefoundries.com/</a> — Twisted consulting, training and support.<br>