def decallmethods(decorator, prefix='test_'):

    def dectheclass(cls):
        for name, m in inspect.getmembers(cls, inspect.ismethod):
            if name.startswith(prefix):
                setattr(cls, name, decorator(m))
return cls
return dectheclass
Applying python decorators to methods in a class