pytest-instafail
pytest-instafail is a plugin for pytest that enhances test reporting by displaying failures and errors immediately as they occur, rather than aggregating them until the entire test session concludes. The current version, 0.5.0, was released on March 31, 2023, indicating active maintenance and compatibility with recent pytest versions.
Warnings
- breaking Version 0.5.0 dropped support for Python 3.6. Ensure your environment uses Python 3.7 or newer.
- breaking pytest-instafail requires pytest 5 or newer. Using it with older pytest versions may lead to compatibility issues or errors.
- deprecated Older versions of pytest-instafail might issue deprecation warnings when used with pytest 7.2.0+ due to changes in hook configuration. Version 0.5.0 addressed this by using `pytest.hookimpl`.
- gotcha When used in conjunction with `pytest-xdist`, ensure `pytest-instafail` is at least version 0.4.2 to avoid issues related to deprecated `pytest-xdist` slave aliases.
Install
-
pip install pytest-instafail
Imports
- Plugin Activation
This is a pytest plugin and is activated via the command line (--instafail) or automatically by pytest upon installation. It does not require explicit Python 'import' statements in user code.
Quickstart
import pytest
def test_passing_example():
assert True
def test_failing_example():
assert False
# To run this, save as 'test_example.py' and execute in terminal:
# pytest --instafail test_example.py