def skip(reason):
"""Unconditionally skip a test."""
import types
def decorator(test_item):
#if not isinstance(test_item, (type, types.ClassType)):
# @functools.wraps(test_item)
# def skip_wrapper(*args, **kwargs):
# raise SkipTest(reason)
# test_item = skip_wrapper
#
#test_item.__unittest_skip__ = True
#test_item.__unittest_skip_why__ = reason
#return test_item
# In older version of Python, tracking skipped tests is
# problematic since the test loader and runner handle this
# internally. For this reason, this compatibility wrapper
# simply wraps skipped tests in a functoin that passes
# silently:
@functools.wraps(test_item)
def skip_wrapper(*args, **kwargs):
pass
return skip_wrapper
return decorator
评论列表
文章目录