-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better alternative to Eventually() #902
Comments
I'd also like to have this. @maratori Do you happen to have put this in some other public package in the meantime where this would be ready for use now? |
@julianbrost It is used in several repos, but they are private. |
I'm currently running into this same need. In particular, I have lots of tests that take this form:
Some of these tests require polling behavior. It would be nice to be able to recover from failed assertions so I can re-run the second and third lines on a timer. Currently, I have to resort to either I think the most flexible solution might be to change the signature of |
Actually, looking at the way this library tests its own asserts by giving it a dummy It shouldn't be too hard to do the same thing with a custom |
This is now |
I've found that
Eventually
is not really useful:condition
.Condition never satisfied
.So I use func
WaitFor
instead: gist.The only disadvantage compared to
Eventually
:WaitFor
will not stop after timeout (immediately). It will call function one more time to pass error message from assertions inside that function to the test.The rest code (with examples) can be found in this gist.
It would be great to see the same feature in testify.
The text was updated successfully, but these errors were encountered: