[TIP] Nose bug? using inspect.ismethod too aggressive?

Fernando Perez fperez.net at gmail.com
Sun Sep 20 21:52:10 PDT 2009


Hi Kumar,

On Sun, Sep 20, 2009 at 1:05 PM, Kumar McMillan
<kumar.mcmillan at gmail.com> wrote:
>
> Seems like there is an edge case here that can possibly be fixed.
> However, I tried applying your patch and got 3 failed tests in the
> loader.  If you want to hack on it, the test suite is easy to run:
>

Many thanks for looking into this.  After a bit of digging, I don't
have a solution but at least some info.  It seems that nose has made
fairly pervasive assumptions about methods always having an im_class
attribute.  This is true of normal methods and classmethods, but
unfortunately not of static methods.

So basically right now, nose does not support static methods as
written.  But because this assumption does appear in so many places,
and I don't really know the nose architecture at all, it's more than I
can fix right now, it would require more time than I can devote to it.

It would be great if a fix was obvious to you, so that (normal, class,
static) methods were all acceptable as test methods in nose, as they
seem to be for unittest.

I'm also open to any alternative solutions to this problem, I'm not
married to mine at all.  But I need a way of writing this kind of
parametric tests that is:

- very easy syntactically (nose already has this)
- easy to debug when they break (this is where today nose's solution,
and all others I know of, fail).

Thanks for the interest!

Cheers,

f



More information about the testing-in-python mailing list