From 1cf0c517a2137f56bf237c2f1c77d025e750c849 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 13:32:20 -0500 Subject: [PATCH] fix: using t.TempDir() to simplify test temp dir manager (backport #23893) (#23917) Co-authored-by: petersssong Co-authored-by: aljo242 --- x/genutil/collect_test.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/x/genutil/collect_test.go b/x/genutil/collect_test.go index fa18cd6f58..7c93df89c2 100644 --- a/x/genutil/collect_test.go +++ b/x/genutil/collect_test.go @@ -36,11 +36,7 @@ func (dni *doNothingIterator) IterateGenesisBalances(_ codec.JSONCodec, _ map[st // Ensures that CollectTx correctly traverses directories and won't error out on encountering // a directory during traversal of the first level. See issue https://github.com/cosmos/cosmos-sdk/issues/6788. func TestCollectTxsHandlesDirectories(t *testing.T) { - testDir, err := os.MkdirTemp(os.TempDir(), "testCollectTxs") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(testDir) + testDir := t.TempDir() // 1. We'll insert a directory as the first element before JSON file. subDirPath := filepath.Join(testDir, "_adir")