{"library":"pytest-reporter","title":"pytest-reporter","description":"pytest-reporter is a Pytest plugin that enables the generation of highly customizable test reports using templates. It provides the data context from a Pytest session, allowing users to create various text-based reports like HTML, LaTeX, or CSV by implementing their own rendering logic. The library is actively maintained with a regular release cadence, often addressing compatibility with new `pytest` versions and enhancing report data.","language":"python","status":"active","last_verified":"Mon May 18","install":{"commands":["pip install pytest-reporter"],"cli":null},"imports":["from jinja2 import Environment, FileSystemLoader, TemplateNotFound"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"# File: conftest.py\nfrom jinja2 import Environment, FileSystemLoader, TemplateNotFound\n\ndef pytest_reporter_render(template_name, dirs, context):\n    \"\"\"This hook is called to render a report template.\"\"\"\n    env = Environment(loader=FileSystemLoader(dirs))\n    try:\n        template = env.get_template(template_name)\n    except TemplateNotFound:\n        # Let other template plugins handle it if not found here\n        return None\n    return template.render(context)\n\n# File: templates/my_report.html\n<!-- Example Jinja2 template -->\n<!DOCTYPE html>\n<html>\n<head><title>Pytest Report</title></head>\n<body>\n    <h1>Test Report</h1>\n    <p>Started: {{ started|strftime('%Y-%m-%d %H:%M:%S') }}</p>\n    <p>Total tests: {{ tests|length }}</p>\n    <ul>\n    {% for test in tests %}\n        <li>{{ test.item.nodeid }} - Status: {{ test.status.word }}\n            {% if test.phases %}\n                <ul>\n                {% for phase in test.phases %}\n                    <li>Phase: {{ phase.name }} - Status: {{ phase.status.word }}</li>\n                {% endfor %}\n                </ul>\n            {% endif %}\n        </li>\n    {% endfor %}\n    </ul>\n</body>\n</html>\n\n# File: test_example.py\ndef test_success():\n    assert True\n\ndef test_failure():\n    assert False\n\n# To run and generate report (from project root):\n# pytest --template-dir=templates --template=my_report.html --report=report.html\n\n","lang":"python","description":"To get started, create a `templates` directory with a Jinja2 HTML template (e.g., `my_report.html`). Then, in your `conftest.py`, implement the `pytest_reporter_render` hook to define how templates are loaded and rendered. Finally, run `pytest` from your project root, specifying the template directory, template file, and output report path using command-line options.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-18","installed_version":"0.5.3","pypi_latest":"0.5.3","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.7,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-reporter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"30.7M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-reporter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.6,"import_time_s":null,"mem_mb":null,"disk_size":"31M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-reporter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"33.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-reporter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.6,"import_time_s":null,"mem_mb":null,"disk_size":"34M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-reporter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"25.2M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-reporter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"26M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-reporter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"25.0M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-reporter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"25M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-reporter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"30.0M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-reporter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3.2,"import_time_s":null,"mem_mb":null,"disk_size":"31M"}]}}