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.
pip install pytest-reportportalVerified import paths — ran on the pinned version, not inferred.
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.
Upgrade Python to 3.9 or newer.
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.
Remove the `retries` parameter from your `pytest.ini` or environment variables. The client now handles retries internally.
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.
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.
Verify that `rp_uuid` and `rp_endpoint` in your `pytest.ini` file or environment variables are correct and match your ReportPortal instance and user profile. Ensure the user's UUID has the necessary permissions.
Install the required dependency using pip: `pip install reportportal-client`. If `pytest-reportportal` is also missing, install both: `pip install pytest-reportportal reportportal-client`.
Add `rp_project = YOUR_PROJECT_NAME` to the `[pytest]` section of your `pytest.ini` file, or set the `RP_PROJECT` environment variable to your ReportPortal project name.
Consult the `pytest-reportportal` documentation or `pytest --help` output for a list of valid command-line options (e.g., `--rp-endpoint`, `--rp-uuid`, `--rp-launch`) and correct your command.