From 2a02734f93c0091275c77e370b7eed03b2c5f18e Mon Sep 17 00:00:00 2001 From: TheFox0x7 Date: Thu, 9 Jan 2025 02:21:47 +0100 Subject: Refactor older tests to use testify (#33140) Refactor checks to use assert/require Use require.Eventually for waiting in elastic and meilisearch tests Use require to exit early instead of assert --- modules/git/repo_language_stats_test.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'modules/git/repo_language_stats_test.go') diff --git a/modules/git/repo_language_stats_test.go b/modules/git/repo_language_stats_test.go index da3871e909..1ee5f4c3af 100644 --- a/modules/git/repo_language_stats_test.go +++ b/modules/git/repo_language_stats_test.go @@ -10,20 +10,18 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestRepository_GetLanguageStats(t *testing.T) { repoPath := filepath.Join(testReposDir, "language_stats_repo") gitRepo, err := openRepositoryWithDefaultContext(repoPath) - if !assert.NoError(t, err) { - t.Fatal() - } + require.NoError(t, err) + defer gitRepo.Close() stats, err := gitRepo.GetLanguageStats("8fee858da5796dfb37704761701bb8e800ad9ef3") - if !assert.NoError(t, err) { - t.Fatal() - } + require.NoError(t, err) assert.EqualValues(t, map[string]int64{ "Python": 134, -- cgit v1.2.3