ITADN

Feature request: Option to append decorator and CLI rerun counts for additive retries

#321OpenBorda 创建于 2026-02-16
B
Bordacommented
## Motivation The plugin currently gives strict priority to the `@pytest.mark.flaky` decorator over the command-line `--reruns` option. However, in environments with non-deterministic failures—such as certain machines or flaky CI runners—it would be useful to allow *additive* retry logic: rerun count from the decorator plus count from CLI or config. This would allow workflow-level overrides. For example: - Standard deterministic tests rerun only as specified in their decorators. - On machines prone to network/connection failures, rerun count could be boosted via CLI for all tests, instead of replacing the decorator count. ## Requested Feature Introduce an option (e.g., `--reruns-additive` or `--reruns-mode=append`) that allows the rerun count from decorator and CLI/config to be summed. ### Example A test decorated with `@pytest.mark.flaky(reruns=2)` run with `--reruns 4` would rerun up to 6 times if this mode is enabled. This would ensure tests with explicit retry logic are not undermined but can be safely boosted on problematic machines without the need to rewrite test code. ## Benefits - Greater flexibility for local and CI workflows. - Supports cases of nondeterminism and local network issues. - Cleaner separation of test-level and workflow-level rerun logic. ## Possible Implementation - Add a new CLI/config option, e.g., `--reruns-mode=append` (`strict` could be the default). - Document priority/order and update rerun calculation as per mode. ## Related Issues - [Issue #306](https://github.com/pytest-dev/pytest-rerunfailures/issues/306) - global override request - [Issue #295](https://github.com/pytest-dev/pytest-rerunfailures/issues/295) - priority clarification --- Thank you for considering this feature!
0 条评论