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

Fernando Perez fperez.net at gmail.com
Sun Sep 20 23:26:12 PDT 2009

On Sun, Sep 20, 2009 at 1:05 PM, Kumar McMillan
<kumar.mcmillan at gmail.com> wrote:
> On Sun, Sep 20, 2009 at 1:05 AM, Fernando Perez <fperez.net at gmail.com> wrote:
>> But inspect.ismethod() returns false for staticmethods, while unittest
>> accepts them (and I need that for my use case).
>> It seems to me that this is a nose bug, fixable with:
>> -            if not ismethod(item):
>> +            if not hasattr(item,'__call__'):
>> I'll try to monkeypatch it in the meantime, but it would be great to
>> have this done upstream, if it's indeed seen as a bug.
> Seems like there is an edge case here that can possibly be fixed.

By the way, for now I can avoid the monkeypatching altogether by not
using a staticmethod and instead requiring my parametric tests to be
written as

def test(self):
  yield 1

The self will be ignored, but it solves this problem.

So it would be great if nose can match unittest on this front, but if
not, it seems that it's not the end of the world for us :)

All the best,


More information about the testing-in-python mailing list