Skip to content
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

refactor: Use assertNotPanics util instead of testify/require in genutil tests #14518

Closed
Closed
12 changes: 10 additions & 2 deletions tests/integration/genutil/gentx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"gotest.tools/v3/assert"

Expand Down Expand Up @@ -299,7 +298,7 @@ func TestDeliverGenTxs(t *testing.T) {
tc.malleate()

if tc.expPass {
require.NotPanics(t, func() {
assertNotPanics(t, func() {
genutil.DeliverGenTxs(
f.ctx, genTxs, f.stakingKeeper, f.baseApp.DeliverTx,
f.encodingConfig.TxConfig,
Expand All @@ -316,3 +315,12 @@ func TestDeliverGenTxs(t *testing.T) {
})
}
}

func assertNotPanics(t *testing.T, f func()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed, best to have the utils function in the SDK, so we can use them everywhere.

defer func() {
if r := recover(); r != nil {
t.Errorf("should not panic: %v", r)
}
}()
f()
}