[Twisted-Python] Using twisted.trial with nose unittest system

Allen Bierbaum abierbaum at gmail.com
Fri Feb 9 16:07:48 EST 2007


On 2/6/07, Jonathan Lange <jml at mumak.net> wrote:
> On 2/7/07, Allen Bierbaum <abierbaum at gmail.com> wrote:
> > On 2/6/07, Christopher Armstrong <radix at twistedmatrix.com> wrote:
> > > On 2/6/07, Allen Bierbaum <abierbaum at gmail.com> wrote:
> > > > someone
> > > > has written a plugin for nose that allows it to test twisted code.  I
> > > > don't think it looks as nice as trial, but it should work for the
> > > > basics.    You can see it here:
> > > > http://python-nose.googlecode.com/svn/trunk/nose/twistedtools.py
> > >
> > > UGH
> > >
> > > def threaded_reactor():
> >
> > Yep.  Not pretty by any means. :(
> >
> > I am sure that any suggestions you have to make it better would be
> > well-recieved by the nose project and the plugin's author.   :)
> >
>
> I still need to spend some more time looking at nose, but in this
> particular case I think the plugin is unnecessary.
>
> If your tests subclass twisted.trial.unittest.TestCase, then they
> should take care of the reactor themselves.[1]

I tried this and things did not work out well.  I am currently getting
some exceptions inside nose that make me think twisted.trial may have
modified the unittest state in a way that it didn't expect.

It is always possible though that this is just a side effect of my
testing method.  Has anyone else tried using trial unittest's directly
inside nose?

-Allen




More information about the Twisted-Python mailing list