{"library":"pytest-harvest","title":"pytest-harvest","description":"pytest-harvest is a pytest plugin that allows you to store data created during your pytest tests execution and retrieve it at the end of the session. This is particularly useful for applicative benchmarking purposes, collecting custom metrics, or generating reports. The current version is 1.10.5, and it maintains a regular release cadence, often to ensure compatibility with new pytest versions and address bug fixes.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install pytest-harvest"],"cli":null},"imports":["from pytest_harvest import get_session_synthesis_dct","def test_something(module_results_dct):","def test_something(session_results_df):","def test_something(saved_shared_data):"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\nfrom pytest_harvest import get_session_synthesis_dct\n\n# conftest.py\n@pytest.fixture\ndef custom_metric_value():\n    return 'important_data'\n\ndef pytest_sessionfinish(session):\n    print(\"\\n--- Session Synthesis Results ---\")\n    results = get_session_synthesis_dct(session)\n    for test_id, res in results.items():\n        custom = getattr(res, 'custom_metric_value', 'N/A')\n        print(f\"Test: {test_id}, Outcome: {res.outcome}, Custom: {custom}\")\n    print(\"---------------------------------\")\n\n# test_example.py\ndef test_success(request, custom_metric_value):\n    request.node.add_pytest_stats(custom_metric_value=custom_metric_value)\n    assert True\n\ndef test_failure(request, custom_metric_value):\n    request.node.add_pytest_stats(custom_metric_value=custom_metric_value + '_failed')\n    pytest.fail(\"Intentionally failed test\")\n\n# To run these tests and see the output:\n# 1. Save the conftest.py content as 'conftest.py' in your test directory.\n# 2. Save the test_example.py content as 'test_example.py' in the same directory.\n# 3. Run from your terminal: pytest -s","lang":"python","description":"This quickstart demonstrates how to define a custom metric using a fixture, store its value during test execution with `request.node.add_pytest_stats`, and then retrieve all collected data at the end of the session using `get_session_synthesis_dct` within a `pytest_sessionfinish` hook. Run `pytest -s` from your terminal to see the results printed.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"1.10.5","pypi_latest":"1.10.5","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.8,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-harvest","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":"19.1M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-harvest","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.8,"import_time_s":null,"mem_mb":null,"disk_size":"20M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-harvest","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":"21.2M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-harvest","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.8,"import_time_s":null,"mem_mb":null,"disk_size":"22M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-harvest","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":"13.0M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-harvest","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.7,"import_time_s":null,"mem_mb":null,"disk_size":"13M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-harvest","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":"12.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-harvest","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.8,"import_time_s":null,"mem_mb":null,"disk_size":"13M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-harvest","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":"18.6M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-harvest","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2,"import_time_s":null,"mem_mb":null,"disk_size":"19M"}]}}