-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Replace testify
usage by gotest.tools
#12332
Comments
Just a note. I don't think we need to rewrite existing tests. But new tests should likely use gotest in particular DeepEqual with protocmp.Transform when using the new protobuf API |
ACK -- Use |
Going forward we should use this, but also for consistency we should try to use the same thign |
Hi. I'm newbie in cosmos-sdk ecosystem. |
Amazing, let us know if you have any questions |
I'm reading CONTRIBUTION guides. |
gotest.tools provides a command to automate the migration: https://pkg.go.dev/gotest.tools@v2.2.0+incompatible/assert/cmd/gty-migrate-from-testify |
@ryanchristo do you have an example of tests I can look at or even a test suite ideally I can look at? Last time I played with gotest it was lacking in rich feature functionality of testify (e.g. suites, various methods on |
We are still using testify's require throughout regen ledger and I hold a similar position and see gotest as lacking features. I was actually considering a proposal to use require throughout before an issue was proposed to stay aligned with the sdk linking to the issue here, so nothing to share at the moment but I can further investigate tradeoffs. |
Gotcha. Looks like we should stick with testify's |
I don't have a super strong opinion about But, I really think we should consider testify suite an anti-pattern. It does not support parallel tests and I don't see a lot of other upsides. A very simple alternative is just doing this: type Fixture struct {
...
}
func initFixture(t *testing.T) *Fixture {
// if cleanup is needed use t.Cleanup()
}
func TestSomething(t *testing.T) {
t.Parallel()
f := initFixture(t)
} This gives you pretty much everything you get from testify |
Yup, pretty much! I just found testify's require API, e.g. |
As per our standup, we'll keep using testify and won't refactor it away in existing touched tests. |
I found that
|
Context: #12291 (comment)
Currently, we are using both
testify
andgotest.tools
through the codebase.Please use gotest.tools/v3/assert wherever possible.
The text was updated successfully, but these errors were encountered: