Registry / testing / pytest-print

pytest-print

JSON →
library1.2.2pypypiunverified

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-print
INSTALL
IMPORT
SIG · PYTEST-PRINT
P
pytest-print
testingpythonv1.2.2
Install
2.7s avg
Import
Disk
29MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 30.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.7s · import 0.000s · 31MB
29MB installed
● package 29MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

printer
def test_example(printer):
from pytest_print import printer
The 'printer' fixture is automatically discovered by pytest and injected into test functions; no explicit import statement is typically needed in test files.
pprint
def test_example(pprint):
from pytest_print import pprint
The 'pprint' fixture is automatically discovered by pytest and injected into test functions for pretty-printing data.
printer_factory
def test_example(printer_factory):
from pytest_print import printer_factory
The 'printer_factory' fixture provides a callable to create custom printer instances.

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.

import pytest def test_printer_fixture(printer): # The 'printer' fixture writes directly to the terminal, bypassing pytest's stdout capture. printer("Hello from pytest-print! This message should always appear.") print("This is a standard print. It will be captured unless pytest is run with -s.") def test_pprint_fixture(pprint): data = {'name': 'Alice', 'age': 30, 'cities': ['New York', 'London']} pprint(data) pprint([1, 2, 3, {'a': 'b', 'c': 'd'}]) # To run this test: # 1. Save as a Python file (e.g., test_my_app.py) # 2. Run from your terminal in the same directory: pytest -v -s test_my_app.py
Debug
Known issues
breakingpytest-print v1.2.0 dropped support for Python 3.8 and 3.9. Subsequent versions, including 1.2.2, require Python >=3.10.
fix
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).
affects: >=1.2.0
gotchaThe `printer` and `pprint` fixtures bypass pytest's standard stdout/stderr capture mechanisms to ensure output is always visible in the terminal. This can be confusing if you expect all `print()` statements to behave similarly.
fix
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.
affects: *
breakingVersion 1.2.1 included internal modernizations for Python 3.10+ and public pytest APIs. While not typically affecting end-user tests directly, this may subtly break compatibility for advanced users or other plugins relying on specific internal behaviors of `pytest-print` prior to this version.
fix
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.
affects: >=1.2.1
Upgrade
Version history
1.2.2latest on PyPI · released Feb 11, 2026
Audit
Dependencies
pytestrequiredCore test framework dependency; pytest-print extends pytest functionality by providing fixtures.
Agent activity
5 hits · last 30 days
node
4
Resources
pytest-print — pip install pytest-print · libregistry