{"library":"pytest-rich","title":"pytest-rich","description":"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pytest-rich"],"cli":{"name":"pytest","version":"pytest 9.0.3"}},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\nimport os\n\n# Create a dummy test file\nwith open(\"test_example.py\", \"w\") as f:\n    f.write(\n\"\"\"import pytest\n\ndef test_success():\n    assert True\n\ndef test_failure():\n    assert False\n\ndef test_error_division_by_zero():\n    1 / 0\n\n@pytest.mark.skip(reason=\"demonstrate skip\")\ndef test_skipped():\n    pass\n\ndef test_warning():\n    pytest.warn(\"This is a test warning.\")\n\n\"\"\"\n    )\n\n# Create a pyproject.toml to enable rich output\nwith open(\"pyproject.toml\", \"w\") as f:\n    f.write(\n\"\"\"[tool.pytest.ini_options]\naddopts = [\n    \"--rich\",\n    \"--rich-tracebacks\",\n    \"--rich-help\",\n    \"--strict-markers\",\n]\n\"\"\"\n    )\n\nprint(\"Created test_example.py and pyproject.toml\")\nprint(\"To run, navigate to this directory in your terminal and execute: pytest\")\n","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}