{"id":5435,"library":"pytest-reportportal","title":"Pytest ReportPortal Agent","description":"pytest-reportportal is a Pytest plugin that serves as an agent for reporting test results to the ReportPortal test automation dashboard. It enables real-time reporting, detailed logs, and execution data analysis for Python tests run with Pytest. The library, currently at version 5.6.6, receives frequent minor updates to improve functionality, fix bugs, and maintain compatibility with Python and the ReportPortal client.","status":"active","version":"5.6.6","language":"en","source_language":"en","source_url":"https://github.com/reportportal/agent-python-pytest","tags":["pytest","reporting","reportportal","test automation","qa"],"install":[{"cmd":"pip install pytest-reportportal","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core client library for interacting with the ReportPortal API. Frequently updated in parallel with the agent.","package":"reportportal-client","optional":false}],"imports":[{"note":"Used for integrating Python's standard logging module with ReportPortal to send logs during test execution.","symbol":"RPLogger","correct":"from reportportal_client import RPLogger"},{"note":"Used as a logging handler to direct Python logs to ReportPortal.","symbol":"RPLogHandler","correct":"from reportportal_client import RPLogHandler"}],"quickstart":{"code":"import pytest\nimport os\n\n# --- pytest.ini (simulated content for quickstart) ---\n# [pytest]\n# rp_endpoint = http://localhost:8080\n# rp_project = default_personal\n# rp_api_key = your_api_key_from_reportportal_profile\n# rp_launch = MyPytestLaunch\n\n# To run this example:\n# 1. Ensure ReportPortal is running (e.g., via Docker).\n# 2. Set environment variables or create a pytest.ini file:\n#    export RP_ENDPOINT=\"http://localhost:8080\"\n#    export RP_PROJECT=\"default_personal\"\n#    export RP_API_KEY=\"your_api_key\"\n# 3. Save the test below as `test_example.py`.\n# 4. Run from your terminal: `pytest --reportportal test_example.py`\n\ndef test_passing_example():\n    assert True\n\ndef test_failing_example():\n    assert False\n\n@pytest.mark.skip(reason=\"demonstrating skip\")\ndef test_skipped_example():\n    pass\n","lang":"python","description":"This quickstart demonstrates how to configure and run Pytest with `pytest-reportportal`. The core configuration involves setting `rp_endpoint`, `rp_project`, and `rp_api_key` (or OAuth credentials) either in a `pytest.ini` file or via environment variables. The `--reportportal` flag activates the plugin during test execution. A simple test file with passing, failing, and skipped tests is provided to show how results are reported."},"warnings":[{"fix":"Upgrade Python to 3.9 or newer.","message":"Python 3.8 support was removed starting from `pytest-reportportal` version 5.6.0. Users on Python 3.8 or older must upgrade their Python version to use recent agent versions.","severity":"breaking","affected_versions":">=5.6.0"},{"fix":"Replace `rp_uuid` in your `pytest.ini` or environment variables with `rp_api_key` or the appropriate `rp_oauth_*` parameters. Your API key can be found in your ReportPortal user profile.","message":"The `rp_uuid` configuration parameter for authentication has been removed since version 5.5.3. It was replaced by `rp_api_key` for API Key authentication or a set of `rp_oauth_*` parameters for OAuth 2.0 Password Grant.","severity":"deprecated","affected_versions":">=5.5.3"},{"fix":"Remove the `retries` parameter from your `pytest.ini` or environment variables. The client now handles retries internally.","message":"The `retries` parameter for ReportPortal client configuration was removed in version 5.6.0. This parameter is no longer supported and will cause configuration errors if present.","severity":"breaking","affected_versions":">=5.6.0"},{"fix":"Test your `pytest-xdist` setup thoroughly with `pytest-reportportal`. If you encounter issues, consider disabling hierarchy-related features (`rp_hierarchy_dirs`, `rp_hierarchy_code`) or running tests without `xdist` if full ReportPortal feature fidelity is critical.","message":"Using `pytest-xdist` with `pytest-reportportal` can lead to issues, especially with hierarchy reporting. While some fixes for `xdist` compatibility have been introduced (e.g., for code reference generation), complex scenarios might still exhibit unexpected behavior or limitations.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be explicit about your configuration hierarchy. For CI/CD, prefer environment variables or command-line arguments to override `pytest.ini` for sensitive data or dynamic launch parameters. Always check the effective configuration if reporting issues arise.","message":"Configuration parameters can be overridden by environment variables and command-line arguments. Environment variables (e.g., `RP_API_KEY`) take precedence over `pytest.ini` settings, and command-line arguments (e.g., `--rp-launch`) take precedence over both. This can lead to unexpected behavior if not managed carefully.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}