pytest-print is a pytest plugin that provides fixtures like `printer` and `pprint` for writing messages directly to the pytest runner terminal, bypassing pytest's default output capture. It is actively maintained, with version 1.2.2 requiring Python >=3.10, and sees regular patch and minor releases.
pip install pytest-printVerified import paths — ran on the pinned version, not inferred.
Demonstrates the use of the `printer` and `pprint` fixtures to output messages directly to the terminal during a pytest run, bypassing standard capture. Note the recommendation to use `-s` for `print()` output to appear.
Upgrade your Python environment to 3.10 or newer, or pin pytest-print to a version less than 1.2.0 if you must use older Python versions (e.g., `pytest-print<1.2.0` for Python 3.9).
Use `printer()` or `pprint()` when you specifically need output to appear immediately on the terminal regardless of pytest's capture settings. For regular `print()` statements, either run pytest with `-s` (or `--capture=no`), or expect them to be captured and displayed only on test failure or with specific `--show-capture` options.
Ensure your testing environment is on Python 3.10+ and that any custom integrations or plugins are tested against `pytest-print` 1.2.1 or newer. Consult `pytest`'s public API for best practices.