My version of Python does not support
@unittest.skip("demonstrating skipping")
from Disable individual Python unit tests temporarily, I understand how to use a decorator to achieve this, i.e.,
def disabled(f):
def _decorator():
print f.__name__ + ' has been disabled'
return _decorator
@disabled
def testFoo():
'''Foo test case'''
print 'this is foo test case'
testFoo()
However, the decorator does not support providing a message for the skipping. May I know how I can achieve this please? I basically want something like
def disabled(f, msg):
def _decorator():
print f.__name__ + ' has been disabled' + msg
return _decorator
@disabled("I want to skip it")
def testFoo():
'''Foo test case'''
print 'this is foo test case'
testFoo()