pytest插件,用于在pytest报告中列出Python警告
项目描述
pytest-warnings
警告
此包不活跃,将不再维护。此包的功能已包含在pytest中。
py.test插件,用于在pytest报告中列出Python警告。
集成于pytest >= 3.1.0。
使用方法
通过以下方式安装
pip install pytest-warnings
如果您输入
py.test -rw
则您的代码中的任何警告都会在pytest报告中报告。您可以使用-W选项或--pythonwarnings,就像对python可执行文件一样。
以下示例忽略所有警告,但打印每个发生的DeprecationWarning一次
py.test -rw -W ignore -W once::DeprecationWarning
您还可以将警告转换为实际错误
py.test -W error
高级使用
您可以通过使用filterwarnings配置选项来获得更精细的警告过滤。
filterwarnings与python的-W标志类似,但它不会转义特殊字符。
示例
# pytest.ini
[pytest]
filterwarnings= default
ignore:.*is deprecated.*:Warning
error::DeprecationWarning:importlib.*
变更记录
0.3.0 - 2017-05-21
添加Travis CI配置。[dwaynebailey (Dwayne Bailey)]
制作通用wheel。[aragilar (James Tocknell)]
由于此插件集成在pytest 3.1.0中,我们显示弃用警告并建议卸载插件。[nicoddemus (Bruno Oliveira), fschulze]
0.2.0 - 2016-10-24
添加filterwarnings选项。[Carreau (Matthias Bussonnier)]
0.1.0 - 2016-06-27
首次发布。[fschulze (Florian Schulze)]
项目详情
关闭
pytest-warnings-0.3.1.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 5939f76fe04ad18297e53af0c9fb38aca1ec74db807bd40ad72733603adbbc7d |
|
MD5 | 89c7f98d43b1e6ce666a35daa1e30f46 |
|
BLAKE2b-256 | e95dc782fd57596801b4eea84243083a80cb666d10dd0b3360123391d0ec7481 |
关闭
pytest_warnings-0.3.1-py2.py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 2b779c3f479179fdb5c3935c44105d21c42938d19913523dd26ca34d2e74209a |
|
MD5 | 0f096753da6bd5b73ce3d1dc5d0ce431 |
|
BLAKE2b-256 | 012f74fecb0fd1a87272fd29af0c41ea86992a070c47373447b6a544f257c4e0 |