tenacity
tenacity copied to clipboard
Support Trio out-of-the-box
This PR makes @retry
just work when running under Trio.
For now, I added trio
to the test deps in tox.ini, so we can test
it. The code is also designed to handle things gracefully if trio
isn't installed, but currently there's not any automated test for
that... how would you like to handle this? Maybe add another
test environment without trio?
@jd How's this look?
Fair enough!
Made that change and also rebased on latest master, to make mergify happy
Hello @njsmith ! I understand it has been over 2 years since this PR was opened. Might there be any chance of a follow-up to support trio out of the box?
I think this feature is great, as it can be easy to forget add trio.sleep
argument to the retry.
I also wonder how to use tenacity with trio.
If I use tenacity.retry() as a decorator for a async function, how can I check the result of the async function via tenacity.retry_if_result()
? And then I got an error TypeError: argument of type 'coroutine' is not iterable, xxx was never awaited
.
Even if I change my retry condition to retry_if_exception
, I got another error TypeError: object NoneType can't be used in 'await' expression
.
Please give me some tips, thank you guys~~~