Patch to allow nose to work with twisted.trial.unittest

43 views
Skip to first unread message

Allen Bierbaum

unread,
Feb 9, 2007, 4:37:30 PM2/9/07
to nose-...@googlegroups.com
I use twisted for much of my application development and I wanted to
test it using nose. I posted a question to the twisted list here:

http://twistedmatrix.com/pipermail/twisted-python/2007-February/014762.html

and asked what the recommended way to do this was. The general
feedback from the twisted devs was that using nose.twistedtools may
not be a good idea. It was suggested that I could just use
twisted.trial.unittest as a base class and have that work with nose.
I gave it a try and it seems to be working but I had to patch nose to
handle a bug.

The patch is attached to this e-mail. As far as I can tell, this is
needed because when twisted uses zope.interface to label
trial.unittest as implementing an interface, it adds an attribute to
the class that can not be queried directly from python. This caused
some code in nose to fail.

Does this patch look acceptable to fix the problem?

-Allen

nose_with_twisted.trial.patch

jason pellerin

unread,
Feb 9, 2007, 4:56:55 PM2/9/07
to nose-...@googlegroups.com
Hi Allen,

> Does this patch look acceptable to fix the problem?

Thanks! It would have been, except, sadly, I beat you to the punch. :)

>>>
r57 | jpellerin | 2007-02-06 15:05:03 -0500 (Tue, 06 Feb 2007) | 1 line

Possible fix for errors with twisted.unittest.TestCase tests
<<<

Rather than catching the attribute error, I decided to call
getattr(cls, item, None). I've heard this now works -- but I don't do
any twisted testing myself, so you may want to give the svn version a
try (easy_install nose==dev or just follow the checkout instructions
etc) and see how it works for you.

Thanks again for the patch. Like I said I don't do much if anything
with twisted, so I'm very interested in any help you can give to
improve nose's support for running twisted tests, since I'm too
ignorant of twisted to see myself what may be needed.

JP

Allen

unread,
Feb 9, 2007, 5:07:27 PM2/9/07
to nose-users

On Feb 9, 3:56 pm, "jason pellerin" <jpelle...@gmail.com> wrote:
> Hi Allen,
>
> > Does this patch look acceptable to fix the problem?
>
> Thanks! It would have been, except, sadly, I beat you to the punch. :)
>
>
>
> r57 | jpellerin | 2007-02-06 15:05:03 -0500 (Tue, 06 Feb 2007) | 1 line
>
> Possible fix for errors with twisted.unittest.TestCase tests
> <<<

Darn. And here I thought I was doing good. :)

I wasn't running from the trunk so I had not seen this commit.

Is the trunk stable enough to use in a production environment right
now?

-Allen

jason pellerin

unread,
Feb 9, 2007, 5:12:51 PM2/9/07
to nose-...@googlegroups.com
> Is the trunk stable enough to use in a production environment right
> now?

I always try to keep trunk stable -- nothing gets checked into trunk
until nose passes its own unit tests, for instance, and major-version
change development is always on a branch -- and it's usually what I'm
using for day-to-day testing at work. So if something does sneak in to
break stuff, it usually doesn't stay broken for too long. If that's
sounds stable enough for your environment, I'd say give it a try.

JP

Reply all
Reply to author
Forward
0 new messages