[Twisted-Python] Re: Using twisted.trial with nose unittest system
glyph at divmod.com
glyph at divmod.com
Wed Feb 7 16:24:18 EST 2007
On 05:36 pm, antoine.pitrou at wengo.com wrote:
>> 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). Tests are
>> exactly the place you never want this to happen :).
>
>That's certainly right, although you should get messages about uncaught
>exceptions or unhandled errbacks, so you'll know that something went
>wrong.
That's not the sort of problem I'm talking about. Some reactor APIs will appear to work when called from the wrong thread, so if you forget a @deferred somewhere, your test might seem to work, or hang in a weird place, or produce different error output each time.
>What happens with Trial when you forget to return the Deferred the test
>should wait on?
Trial doesn't require tests to return Deferreds. If there is no Deferred, the test completes immediately.
>> All in all it seems like it would be simpler to just use trials'
>> TestCase class with nose. Is there any reason not to?
>
>Given that Trial is a self-contained tool, and given that nose also has
>its own test running and collecting, I simply didn't expect this to work
>or to keep working accross versions of both tools.
This is definitely a concern, but your current approach doesn't seem any less fragile.
>> 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.
>
>Of course, but to use Trial you must install Twisted don't you ?
>Which is quite a big dependency,
Is 2 megabytes really too big?
>and Twisted does not yet support being easy_install'ed.
... and nose doesn't yet support being apt-get installed ;-)
If you'd like to see easy_install support for Twisted, please feel free to contribute support for it; the release manager could probably use some help maintaining setup.py in general.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20070207/ba79f1f1/attachment.htm
More information about the Twisted-Python
mailing list