Releases: str0zzapreti/pytest-retry
v1.7.0
New Features
- Enabled changing the outcome name for compatibility with reporting plugins by @andrew-cleveland in #48
Bug Fixes
- Fix: Prevent
ResourceWarning
when usingpytest-xdist
by @francis-clairicia in #39 - Update readme docs for reporting outcome by @str0zzapreti in #49
New Contributors
- @francis-clairicia made their first contribution in #39
- @andrew-cleveland made their first contribution in #48
Full Changelog: 1.6.3...1.7.0
v1.6.3
Bug Fixes
- use verbosity count for trace limit rather than unlimited trace depth in verbose mode @str0zzapreti in #41
- Code snippets are now highlighted in the readme for supported editors (thanks @Borda)
Full Changelog: 1.6.2...1.6.3
v1.6.2
Bug Fixes
- fixed Item instantiation error in Pytest 8 by @str0zzapreti in #35
Full Changelog: 1.6.1...1.6.2
v1.6.1
Bug Fixes
- Fixed an OSError exception which could occur due to a socket port assignment conflict when running multiple instances of pytest-retry with pytest-xdist n > 1 simultaneously on the same machine
v1.6.0
New Features
- Retry reports will now be displayed when using pytest-xdist with n > 1
- Retry reports now log if a retried test passed on a subsequent attempt. Previously, only failures were logged
Fixes
- Additional test coverage to validate xdist compatability for retry reports
- Additional test coverage to prevent regressions with fixture resets during retries
- Cleaned up some internal naming for clarity and consistency
Full Changelog: 1.5.0...1.6.0
v1.5.0
New Features
- Global retries can now be configured using .ini files as an alternative to using command line options. This also adds pyproject.toml support for free. See the updated readme for details.
Bug Fixes
- Cumulative timing mode only summed first and final attempt durations when retries > 1.
- Empty flaky mark would default to 0 retries, but still retry once (task failed successfully)
v1.4.2
v1.4.1
Hotfix Release
Bug Fixes:
- Fixed a module directory which was causing an import error when attempting to retry tests.
v1.4.0
New features:
- A new
condition
argument is available for the flaky mark which provides greater control over when tests are retried. Tests with acondition
argument in the flaky mark will only be retried ifcondition 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.
v1.3.0
New features:
- Test retries can now be made conditional upon a list of filtered or excluded exception types. Filtered exceptions will only initiate retries if the failed test attempt occurred due to an exception in the list. Excluded exceptions will only initiate retries if the failed test attempt does not have an exception matching a listed exception.
- At a global level, this feature is implemented using two new hooks, either of which (but not both) can be defined in conftest.py.
- At a per-test level, two new arguments have been added to the flaky mark. Again, only one of these can be specified at a time.