<html><body>On 03:32 pm, antoine.pitrou@wengo.com wrote:<br />&gt;<br />&gt;Hi Jean-Paul,<br />&gt;<br />&gt;&gt; The one practical problem which this method of integration has is that<br />&gt;&gt; it will not allow unit tests to run child processes. &#160;So, one wouldn't<br />&gt;&gt; be able to run Twisted's test suite with nose using this. &#160;Of course,<br />&gt;&gt; if one has no interest in running tests which run child processes, then<br />&gt;&gt; this may not be a big deal.<br />&gt;<br />&gt;Do you mean because the reactor does not receive signals?<br /><br />Yes. &#160;Also, it's highly likely that the tests won't stop cleanly on ^C.<br /><br />More serious than the process-running issue, from my point of view, is the fact that if you forget the "@deferred" decorator on a test that uses any reactor API, or code that internally _uses_ any reactor API, you will put your tests into a non-deterministic state, and although they'll pass _most_ of the time, they will die depending on the load characteristics of your machine at the time and (insert long-winded rant about the evil things threads do to your code here). &#160;Tests are exactly the place you never want this to happen :).<br /><br />The documentation for this module should be clear on the fact that Twisted-using tests are _absolutely required_ to use the decorator, even if they don't need to wait on a deferred. &#160;Of course, that implies that the "you must return a twisted Deferred" message should probably be removed and that case dealt with.<br /><br />Also, setUp and tearDown methods also need the decorator applied, I think, not just test methods.<br /><br />All in all it seems like it would be simpler to just use trials' TestCase class with nose. &#160;Is there any reason not to?<br /><br />&gt;&gt; &gt;Let me give a few points as for nose vs. Trial :<br /><br />You are welcome to use nose, of course, but some of these reasons sounded kind of flimsy to me.<br /><br />&gt;&gt; &gt;- nose does not depend on Twisted. Unless all your Python projects make<br />&gt;&gt; &gt;use of Twisted, you certainly don't like having to use a different<br />&gt;&gt; &gt;testing tool depending on the project.<br /><br />Trial doesn't force your code to make use of Twisted, and as Mr. Lange has declared previously, it goes to some lengths to be compatible with stdlib unit tests. &#160;It can run and discover stdlib tests, as well as being run by the stdlib runner, and I've used it to test tiny projects which do not use Twisted code anywhere.<br /><br />So, Trial only requires Twisted insofar as Nose requires Nose. &#160;It's part of its implementation. &#160;If you use Twisted for _any_ of your development, it's already installed.<br /><br />&gt;&gt; &gt;- nose has nice features, including the ability to write tests as<br />&gt;&gt; &gt;functions without having to write classes<br /><br />This just sounds like TIMTOWTDI to me. &#160;I *like* the fact that all test methods look the same ;).<br /><br />&gt;&gt; &gt;- nose has a plugin system which already provides several extensions<br /><br />In the spirit of completeness, see trial's --help-reporters and --reporter option. &#160;These are discovered using plugins.<br /><br />Please do not take this argument seriously though. &#160;:) &#160;There is widespread consensus that this plugin API is not very good and it is likely to change. &#160;Still, it exists and you can use it.<br /><br />See:<br />&#160; &#160; http://twistedmatrix.com/trac/browser/sandbox/exarkun/merit/trunk/twisted/plugins/rr.py<br /><br />Although, perhaps the utility of the plugin system is decreased more by the fact that nobody knows about it than by its sub-optimal API, which leads into your next point...<br /><br />&gt;&gt; &gt;- nose is documented<br /><br />This is a very, very good point. &#160;Trial's documentation is extremely weak.<br /><br />Does anyone (and by "anyone" I mean "anyone but JML, who has already done more work on trial than any reasonable person ever would") want to volunteer to write a "test driven development with Twisted" lore document? &#160;I've introduced many people to Twisted in recent weeks, and each time I ended up having to do a live demonstration of how to write a test module, how to run the trial command line, and (for those lucky enough to use emacs) how to get twisted-dev.el loaded so that f9 will do the right thing. &#160;This stuff isn't clear even to people already familiar with Python and unit testing, let alone to people who are learning TDD for the first time with trial.<br /><br /></body></html>