I am using the @retry decorator on a function which makes an HTTP-request.
I am using this exact decorator call as an example:
@retry(stop=stop_after_attempt(7), wait=wait_random_exponential(multiplier=1, max=60))
def func():
...
requests.post(...)
I have a unit tests which tests, that func does indeed get called multiple times when the post-request fails.
But it is a bit annoying that the test takes a long time.
Is it possible to disable the wait time somehow only in the unit test to make the test faster?
Do I have to mock a specific function?
I also posted this on stackoverflow, in case you want some points :)
https://stackoverflow.com/questions/47906671/python-retry-with-tenacity-disable-wait-for-unittest
I am using the
@retrydecorator on a function which makes an HTTP-request.I am using this exact decorator call as an example:
I have a unit tests which tests, that
funcdoes indeed get called multiple times when the post-request fails.But it is a bit annoying that the test takes a long time.
Is it possible to disable the
waittime somehow only in the unit test to make the test faster?Do I have to mock a specific function?
I also posted this on stackoverflow, in case you want some points :)
https://stackoverflow.com/questions/47906671/python-retry-with-tenacity-disable-wait-for-unittest