{"library":"pytest-print","title":"pytest-print","description":"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pytest-print"],"cli":null},"imports":["def test_example(printer):","def test_example(pprint):","def test_example(printer_factory):"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\n\ndef test_printer_fixture(printer):\n    # The 'printer' fixture writes directly to the terminal, bypassing pytest's stdout capture.\n    printer(\"Hello from pytest-print! This message should always appear.\")\n    print(\"This is a standard print. It will be captured unless pytest is run with -s.\")\n\ndef test_pprint_fixture(pprint):\n    data = {'name': 'Alice', 'age': 30, 'cities': ['New York', 'London']}\n    pprint(data)\n    pprint([1, 2, 3, {'a': 'b', 'c': 'd'}])\n\n# To run this test:\n# 1. Save as a Python file (e.g., test_my_app.py)\n# 2. Run from your terminal in the same directory: pytest -v -s test_my_app.py","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}