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

Allen Bierbaum abierbaum at gmail.com
Fri Feb 9 16:39:53 EST 2007


Ok, so I found a way to fix this.  I now have nose running with a
twisted-based test derived from twisted.trial.unittest.TestCase.

I had to patch nose to get this to work:  See:
http://groups.google.com/group/nose-users/browse_frm/thread/0b8e6d7c165032ec

Thanks for all the feedback.  Hopefully things will just work now. :)

-A

On 2/9/07, Allen Bierbaum <abierbaum at gmail.com> wrote:
> 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