retry
retry copied to clipboard
Overriding retry values for testing
Calling a function decorated with @retry
in a unittest can potentially take a long while if you want to test error handling. Is there (or could there be) a convenient way to override e.g. delay? Since the decorators are run at import (right?) it is not as easy as using a constant.
@patch.object(retry.api.time, 'sleep')
If you're using pytest, you can drop this in conftest.py:
@pytest.fixture(scope='session', autouse=True)
def patch_retry():
with mock.patch.object(retry.api.time, 'sleep'):
yield