_unittest.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:datatest 作者: shawnbrown 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号