def only_if_subclass(meth):
 @wraps(meth)
 def test_only_subclass(self, *args, **kwds):
  'Note that this method needs to start with test_ in order for nose\n        to run it!'
  for base_klass in self.__class__.__bases__:
   if ((meth.__name__ in dir(base_klass)) and (base_klass.__name__ != self.__class__.__name__)):
    return meth(self, *args, **kwds)
  return
 return test_only_subclass

def only_if_subclass ( meth ) : @ wraps ( meth ) def test_only_subclass ( self , * args , ** kwds ) : for base_klass in self . __class__ . __bases__ : if ( ( meth . __name__ in dir ( base_klass ) ) and ( base_klass . __name__ != self . __class__ . __name__ ) ) : return meth ( self , * args , ** kwds ) return return test_only_subclass
function to decorate tests that should not be called unless they are a subclass of .