**New features:**
- A new `condition` argument is available for the flaky mark which provides greater control over when tests are retried. Tests with a `condition` argument in the flaky mark will only be retried if `condition is True`. This can be used to, for example, configure a test to only retry when running on a specific operating system or during a specific time of day.
Note: There is no matching command line parameter for `condition`, but the documentation has been updated to suggest an easy workaround if you need to globally add the same condition to all of your tests at once without marking each individually.
**BREAKING CHANGES:**
Previously, any arguments not specified in a flaky mark would fall back to the default plugin values. From 1.4.0 onwards, unspecified arguments will now fall back to your _global_ defaults if specified. To understand the difference in behavior, consider the following case:
pytest-retry defaults to a value of `0` for retry delay unless specified via the command line or a flaky mark
You run the following test file
import pytest
pytest.mark.flaky(retries=3)
def test_unreliable_function():
testing some unreliable function here
assert expected function result
with the following command line arguments:
python -m pytest --retries=2, --retry-delay=5
Since the flaky mark does not specify a delay argument, prior to version 1.4.0, `test_unreliable_function` would be retried 3 times (flaky mark args override command line) with **_0_** delay between attempts. From version 1.4.0 onwards, `test_unreliable_function` would be retried 3 times with a 5 second delay between each attempt.
In other words, flaky marks before 1.4.0 silently ignore _all_ of your command line options, while flaky marks from 1.4.0 onward will respect any command line options that you did not explicitly wish to override
If you have a configuration which relies on the previous behavior and want to upgrade, it should be simple to update your affected tests accordingly. This change was made according to the principle of least surprise (the new behavior appears more intuitive), but please feel free to provide feedback on this change.
**Bug Fixes:**
Fixed a bug where 'excluded' exceptions passed to a flaky mark were not being filtered.
Fixed a test which was validating this incorrect behavior by mistake.