Seb*_*zny 21 python testing django pytest pytest-django
我只是运行py.test我的代码并得到以下输出:
================== 6 passed, 2 pytest-warnings in 40.79 seconds =======================
Run Code Online (Sandbox Code Playgroud)
但是,我看不出有什么py.test想提醒我的.如何打开警告输出到控制台?
py.test --help给我--strict一面旗帜:
- 严格模式下运行pytest,警告成为错误.
但是我只是想看看输出,而不是让我的测试失败.
我检查了pytest.org和这个问题,但他们只关心在python中声明警告,而不是在命令行上显示警告.
sas*_*shk 25
在这种情况下,pytest-warnings是为pytest和/或它的插件生成的警告.没有为您的代码生成这些警告.要在报告中列出它们,您需要使用选项-r w.以下是部分py.test --help:
-r chars show extra test summary info as specified by chars (f)ailed,
(E)error, (s)skipped, (x)failed, (X)passed
(w)pytest-warnings (a)all.
Run Code Online (Sandbox Code Playgroud)
这将允许在报告中显示警告(记录的顶部)将列出哪些pytest插件使用弃用的参数(在我的情况下):
...
================================ pytest-warning summary ================================
WI1 /Projects/.tox/py27/lib/python2.7/site-packages/pytest_timeout.py:68 'pytest_runtest_protocol' hook uses deprecated __multicall__ argument
WI1 /Projects/.tox/py27/lib/python2.7/site-packages/pytest_capturelog.py:171 'pytest_runtest_makereport' hook uses deprecated __multicall__ argument
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6288 次 |
| 最近记录: |