How to show warnings in py.test

In this case, pytest-warnings are warnings which were generated for pytest and/or it’s plugins. These warnings were not generated for your code. In order to list them in the report, you will need to use option -r w. Here is portion of 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.

This will allow to show warnings in the report (top portion of the record) will list which pytest plugins use deprecated arguments (in my case bellow):

...
================================ 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
...

Leave a Comment