Skip to content

Latest commit

 

History

History
77 lines (48 loc) · 2.4 KB

README.rst

File metadata and controls

77 lines (48 loc) · 2.4 KB

pytest-capturewarnings-ng

See Build Status on GitHub Actions

A simple xdist compatible plugin to capture warnings into a report file


Features

Captures warnings from a test run, outputting it to the report file.

Aims to be xdist-compatible.

Requirements

  • pytest

Installation

You can install "pytest-capturewarnings-ng" via pip from PyPI:

$ pip install git+https://github.com/kwasd/[email protected]

Usage

Try --help to see a new option:

--warnings-output-file WARNINGS_OUTPUT_FILE
                      Report file to write warnings to (defaults to
                      test_warnings.txt)

The output is written to report file:

<NODE> @ <WARNING>

Example:

tests.demo/test_1.py::test_hello_world_1[1] @ /home/vmusin/pytest-capturewarnings-ng/tests.demo/test_1.py:7: UserWarning: warning 1   warnings.warn('warning 1')
tests.demo/test_1.py::test_hello_world_1[1] @ /home/vmusin/pytest-capturewarnings-ng/tests.demo/test_1.py:9: UserWarning: warning 2   warnings.warn('warning 2')
tests.demo/test_1.py::test_hello_world_1[2] @ /home/vmusin/pytest-capturewarnings-ng/tests.demo/test_1.py:7: UserWarning: warning 1   warnings.warn('warning 1')
tests.demo/test_1.py::test_hello_world_1[2] @ /home/vmusin/pytest-capturewarnings-ng/tests.demo/test_1.py:9: UserWarning: warning 2   warnings.warn('warning 2')

Contributing

Contributions are very welcome. Tests can be run with pytest, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the Apache Software License 2.0 license, "pytest-capturewarnings-ng" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.