pytest-rich is a pytest plugin that integrates the rich library to provide enhanced, colorful, and highly readable output for test sessions. It improves the default pytest terminal output with features like better traceback formatting, progress bars, and syntax highlighting. As of version 0.2.0, it is actively maintained with a relatively stable release cadence, primarily focusing on bug fixes and compatibility updates.
pip install pytest-richNo compatibility data collected yet for this library.
This quickstart demonstrates basic usage of `pytest-rich` by creating a few simple tests (success, failure, error, skipped, warning) and configuring `pytest` via `pyproject.toml` to enable rich output, tracebacks, and help messages. Run `pytest` in the terminal to see the enhanced output.
If experiencing garbled output, try disabling other output-modifying plugins (e.g., `pytest-xdist`, `pytest-html`) one by one, or run `pytest --disable-rich` to confirm `pytest-rich` is the cause. Review plugin documentation for compatibility notes.
Ensure both `pytest-rich` and `rich` are updated to recent, compatible versions (`pip install --upgrade pytest-rich rich`). Check the `pytest-rich` GitHub repository for known compatibility issues with specific `rich` versions.
Install both libraries: `pip install pytest-rich rich`.
Ensure `pytest-rich` is installed in the active virtual environment. Try running `python -m pytest` instead of just `pytest` to ensure you're using the `pytest` executable associated with your current Python environment.
Update `rich` (`pip install --upgrade rich`), try a different terminal emulator, or temporarily disable other `pytest` plugins (`pytest -p no:xdist --rich`) to identify conflicts. Check the `pytest-rich` documentation for known terminal or plugin incompatibilities.