首页 > 解决方案 > Pytest 断言具有异常块但未引发异常的函数

问题描述

在 pytest 中,我需要对像 a() 这样的函数进行单元测试

def a():
    try:
        some_error_line
    except Exception,e:
        logging.debug("----")

如何断言不引发异常的函数 a() ?

标签: pythonpytestpython-unittest

解决方案


推荐阅读