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
add EventuallyWithT assertion #1264
add EventuallyWithT assertion #1264
Conversation
13548f5
to
f3b35fa
Compare
ad3e339
to
15ae495
Compare
This change updates the "EventuallyWithT" assertion variants (regular, formatted, requirement) to consider a condition as "met" if no assertion errors were raised in a tick. This allows to write easier conditions which simply contain assertions, without needing to return a bool. The equivalent of a condition returning true in the previous implementation would be a a condition with a single "assert.True(..)" call.
Change "EventuallyWithT" condition acceptance to no-errors raised
c781da9
to
988ad34
Compare
@boyan-soubachov if you have a minute 🙏 |
I implemented something similar about a year ago, this looks like a good solution. What needs to happen to get this merged? I'm running up against this use case again and would love to have this available. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
Methods
But all this is now part of the public API. :( |
I can't understand how adding such a feature has gone into a patch release of testify. Does this gives us (maintainers) the permission to also fix it in a patch release? Usage in the wild on GitHub: https://github.com/search?q=content%3Aassert.EventuallyWithT+language%3Ago+NOT+user%3Astretchr+NOT+path%3Aassert%2F+NOT+path%3Arequire%2F&type=code Cc: @brackendawson |
Probably the minor version should have been bumped when this was released. Fixing it should be a patch unless we chnage the API. I think we should do the right things, perhaps this discussion deserves an issue to tackle release higyne? I'm also somewhat interested in some automated testing before releases using a lot of real modules that import testify, there have been some regressions in recent releases. |
Summary
This adds a version of Eventually that allows to do
assertions
in the condition.Changes
EventuallyWithT
assertion.CollectT
helper struct.Motivation
The current
Eventually
only returns one summary error in case of a failure. This is not very helpful if several conditions need to be matched in the condition function. This version collects all failures of a tick and replays the last tick's failures after the timeout.Thus the last iteration's errors can be shown to the user.
Example Usage
Related issues
Closes #902