Skip to content

Support retry integration with pytest-rerunfailures #403

@evgeniyamuravyeva

Description

@evgeniyamuravyeva

Is your feature request related to a problem? Please describe.
Currently, rp agent doesn't integrate with pytest-rerunfailures plugin - it reports all retry attempts as a single test execution instead of separate test attempts with proper retry flags.

Describe the solution you'd like
I would like pytest-reportportal to properly integrate with pytest-rerunfailures by:

  1. Detecting when a test is being retried via pytest-rerunfailures
  2. Starting a new test item in ReportPortal for EACH retry attempt with retry=true flag
  3. Setting proper retry metadata (retry number, total retries)
  4. Maintaining separate execution history for each retry attempt

Describe alternatives you've considered
Tried to implement pytest_runtest_setup hook by finishing previous item and starting new through item.config.py_test_service.rp with {"retry": True} in payload if item.execution_count > 1, but according to rp client new test item is created but i don't see it under my item in reportportal

Additional context

  • pytest-rerunfailures implements retries in pytest_runtest_protocol hook with a while loop
  • Currently, ReportPortal's pytest_runtest_protocol hook starts the test once outside the retry loop and finishes it once after all retries
  • This causes all retry attempts to be reported under the same test item and without retry flag
  • The execution_count attribute from pytest-rerunfailures is available and can be used to detect retries

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions