setup_retryΒΆ
.. py:function:: setup_retry(context: ~typing.Any, max_retries: int = 0, retry_tags: list[str] | None = None, retry_on: list[type[Exception] | str] | None = None, retry_delay: float = 0.0, backoff_factor: float = 1.0, on_retry: ~collections.abc.Callable[[~typing.Any, ~typing.Any, int, Exception | None], None] | None = None, max_total_retries: int | None = None) -> None :module: behave_retry
Configure retry on the behave context.
Call this in before_all in your environment.py.
This patches behave.model.Scenario.run so that failed scenarios
are automatically re-run up to max_retries times.
:param context: Behave context object.
:param max_retries: Maximum retries per scenario (0 = no retry).
:param retry_tags: Only retry scenarios with these tags.
:param retry_on: Only retry on these exception types.
:param retry_delay: Seconds to wait before each retry (0 = no delay).
:param backoff_factor: Multiplier applied to retry_delay after each
retry. Must be >= 1.0.
:param on_retry: Optional callback invoked before each retry with
(context, scenario, attempt, exception).
:param max_total_retries: Global budget for total retries across all
scenarios. None = unlimited.