test_warn.py 文件源码

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

项目:warn 作者: Carreau 项目源码 文件源码
def test_1():


    with pytest.warns(DeprecationWarning) as records:
        warnings.simplefilter('ignore')
        print('warnings.warn is ', warnings.warn.__module__)
        print('filters', warnings.filters)
        filterwarnings('default', category=DeprecationWarning,
            emodule='examples.dependency')
        filterwarnings('ignore', category=DeprecationWarning,
            emodule='examples.dependency.bar')
        consumer()

    for r in records.list:
        print('Record :', r.message, 'In file', r.filename)
    assert len(records) == 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号