python类skip()的实例源码

support.py 文件源码 项目:cryptogram 作者: xinmingzhang 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def impl_detail(msg=None, **guards):
    if check_impl_detail(**guards):
        return _id
    if msg is None:
        guardnames, default = _parse_guards(guards)
        if default:
            msg = "implementation detail not available on {0}"
        else:
            msg = "implementation detail specific to {0}"
        guardnames = sorted(guardnames.keys())
        msg = msg.format(' or '.join(guardnames))
    return unittest.skip(msg)
support.py 文件源码 项目:cryptogram 作者: xinmingzhang 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def skip_unless_symlink(test):
    """Skip decorator for tests that require functional symlink"""
    ok = can_symlink()
    msg = "Requires functional symlink implementation"
    return test if ok else unittest.skip(msg)(test)
support.py 文件源码 项目:cryptogram 作者: xinmingzhang 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def skip_unless_xattr(test):
    """Skip decorator for tests that require functional extended attributes"""
    ok = can_xattr()
    msg = "no non-broken extended attribute support"
    return test if ok else unittest.skip(msg)(test)
support.py 文件源码 项目:Repobot 作者: Desgard 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def requires_resource(resource):
    if resource == 'gui' and not _is_gui_available():
        return unittest.skip("resource 'gui' is not available")
    if is_resource_enabled(resource):
        return _id
    else:
        return unittest.skip("resource {0!r} is not enabled".format(resource))
support.py 文件源码 项目:Repobot 作者: Desgard 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def impl_detail(msg=None, **guards):
    if check_impl_detail(**guards):
        return _id
    if msg is None:
        guardnames, default = _parse_guards(guards)
        if default:
            msg = "implementation detail not available on {0}"
        else:
            msg = "implementation detail specific to {0}"
        guardnames = sorted(guardnames.keys())
        msg = msg.format(' or '.join(guardnames))
    return unittest.skip(msg)
support.py 文件源码 项目:Repobot 作者: Desgard 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def skip_unless_symlink(test):
    """Skip decorator for tests that require functional symlink"""
    ok = can_symlink()
    msg = "Requires functional symlink implementation"
    return test if ok else unittest.skip(msg)(test)
support.py 文件源码 项目:Repobot 作者: Desgard 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def skip_unless_xattr(test):
    """Skip decorator for tests that require functional extended attributes"""
    ok = can_xattr()
    msg = "no non-broken extended attribute support"
    return test if ok else unittest.skip(msg)(test)
__init__.py 文件源码 项目:kscore 作者: liuyichen 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def skip_unless_has_memory_collection(cls):
    """Class decorator to skip tests that require memory collection.

    Any test that uses memory collection (such as the resource leak tests)
    can decorate their class with skip_unless_has_memory_collection to
    indicate that if the platform does not support memory collection
    the tests should be skipped.
    """
    if platform.system() not in ['Darwin', 'Linux']:
        return unittest.skip('Memory tests only supported on mac/linux.')(cls)
    return cls
__init__.py 文件源码 项目:oocgcm 作者: lesommer 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def requires_xarray(test):
    return test if has_xarray else unittest.skip('requires xarray')(test)
__init__.py 文件源码 项目:oocgcm 作者: lesommer 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def requires_dask(test):
    return test if has_dask else unittest.skip('requires dask')(test)
__init__.py 文件源码 项目:oocgcm 作者: lesommer 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def requires_numba(test):
    return test if has_numba else unittest.skip('requires numba')(test)
__init__.py 文件源码 项目:oocgcm 作者: lesommer 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def requires_matplotlib(test):
    return test if has_matplotlib else unittest.skip('requires matplotlib')(test)
__init__.py 文件源码 项目:oocgcm 作者: lesommer 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def requires_bottleneck(test):
    return test if has_bottleneck else unittest.skip('requires bottleneck')(test)
backports.py 文件源码 项目:Sudoku-Solver 作者: ayush1997 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def skip(reason):
        def decorator(test_item):
            if isinstance(test_item, type) and issubclass(test_item, unittest.TestCase):
                class skip_wrapper(test_item):
                    def setUp(self):
                        raise SkipTest(reason)
            else:
                @functools.wraps(test_item)
                def skip_wrapper(*args, **kwargs):
                    raise SkipTest(reason)
            return skip_wrapper
        return decorator
backports.py 文件源码 项目:Sudoku-Solver 作者: ayush1997 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def skipIf(condition, reason):
        if condition:
            return skip(reason)
        else:
            return lambda item: item
backports.py 文件源码 项目:Sudoku-Solver 作者: ayush1997 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def skipUnless(condition, reason):
        if condition:
            return lambda item: item
        else:
            return skip(reason)
support.py 文件源码 项目:UMOG 作者: hsab 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def requires_resource(resource):
    if resource == 'gui' and not _is_gui_available():
        return unittest.skip("resource 'gui' is not available")
    if is_resource_enabled(resource):
        return _id
    else:
        return unittest.skip("resource {0!r} is not enabled".format(resource))
support.py 文件源码 项目:UMOG 作者: hsab 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def impl_detail(msg=None, **guards):
    if check_impl_detail(**guards):
        return _id
    if msg is None:
        guardnames, default = _parse_guards(guards)
        if default:
            msg = "implementation detail not available on {0}"
        else:
            msg = "implementation detail specific to {0}"
        guardnames = sorted(guardnames.keys())
        msg = msg.format(' or '.join(guardnames))
    return unittest.skip(msg)
support.py 文件源码 项目:UMOG 作者: hsab 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def skip_unless_symlink(test):
    """Skip decorator for tests that require functional symlink"""
    ok = can_symlink()
    msg = "Requires functional symlink implementation"
    return test if ok else unittest.skip(msg)(test)
support.py 文件源码 项目:UMOG 作者: hsab 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def skip_unless_xattr(test):
    """Skip decorator for tests that require functional extended attributes"""
    ok = can_xattr()
    msg = "no non-broken extended attribute support"
    return test if ok else unittest.skip(msg)(test)


问题


面经


文章

微信
公众号

扫码关注公众号