test_support.py 文件源码

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

项目:data_utilities 作者: fmv1992 项目源码 文件源码
def is_inside_recursive_test_call():
    """Test if a function is running from a call to du.test()."""
    frame = inspect.currentframe()
    count_test = 0
    while frame:
        # Test breaking condition.
        if count_test >= 1:
            return True
        # Find if there is a breaking condition and update the value.
        test_function = frame.f_locals.get('test')
        if (hasattr(test_function, '_testMethodName')) and (
                test_function._testMethodName ==
                'test_module_level_test_calls'):
            count_test += 1
        # Go to next frame.
        frame = frame.f_back
    return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号