A simple xdist compatible plugin to capture warnings into a report file
Captures warnings from a test run, outputting it to the report file.
Aims to be xdist-compatible.
- pytest
You can install "pytest-capturewarnings-ng" via pip from PyPI:
$ pip install git+https://github.com/kwasd/[email protected]
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')
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.
Distributed under the terms of the Apache Software License 2.0 license, "pytest-capturewarnings-ng" is free and open source software
If you encounter any problems, please file an issue along with a detailed description.