Go to file
Matthias Bussonnier bc94a51a96 Add a warning option which does not escape its arguments.
This is useful when to use regular expressions, like for example ignore
a bunch of dynamic messages
    --filterwarnigns 'ignore:Please use assert.* instead.:'

Or ignore all the warnings in a sub-backage
    --filterwarnigns 'ignore:::package.submodule.*'

This is also available in the ini file as the filterwarnigns options
2016-10-22 09:58:13 -07:00
.gitignore Initial commit. 2016-06-22 12:21:51 +02:00
LICENSE Initial commit. 2016-06-22 12:21:51 +02:00
MANIFEST.in Add MANIFEST.in. 2016-06-27 11:32:38 +02:00
README.rst Add a warning option which does not escape its arguments. 2016-10-22 09:58:13 -07:00
helper_test_a.py Add a warning option which does not escape its arguments. 2016-10-22 09:58:13 -07:00
helper_test_b.py Add a warning option which does not escape its arguments. 2016-10-22 09:58:13 -07:00
pytest_warnings.py Add a warning option which does not escape its arguments. 2016-10-22 09:58:13 -07:00
setup.py Initial commit. 2016-06-22 12:21:51 +02:00
test_warnings.py Add a warning option which does not escape its arguments. 2016-10-22 09:58:13 -07:00
test_warnings2.py Initial commit. 2016-06-22 12:21:51 +02:00
tox.ini Initial commit. 2016-06-22 12:21:51 +02:00

README.rst

pytest-warnings
===============

py.test plugin to list Python warnings in pytest report


Usage
-----

install via::

    pip install pytest-warnings

if you then type::

    py.test -rw

any warnings in your code are reported in the pytest report.
You can use the ``-W`` option or ``--pythonwarnings`` exactly like for the ``python`` executable.

The following example ignores all warnings, but prints DeprecationWarnings once per occurrence::

    py.test -rw -W ignore -W once::DeprecationWarning

You can also turn warnings into actual errors::

    py.test -W error


Advance usage
=============

You can get more fine grained filtering of warnings by using the
``filterwarnings`` configuration option.

``filterwarnings`` works like the python's ``-W`` flag except it will not
escape special characters.

Example
-------

.. code::

    # pytest.ini
    [pytest]
    filterwarnings= default
                    ignore:.*is deprecated.*:Warning
                    error::DeprecationWarning:importlib.*


Changes
=======

0.1.0 - 2016-06-27
------------------

- Initial release.
  [fschulze (Florian Schulze)]