Skip to content

Commit

Permalink
Merge pull request #2194 from alexandear/refactor/pgconn-tests
Browse files Browse the repository at this point in the history
Simplify pgconn tests by using T.TempDir
  • Loading branch information
jackc authored Dec 17, 2024
2 parents 3e6c719 + 7cf7bc6 commit ad87d47
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pgconn/pgconn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2103,8 +2103,9 @@ func TestConnCopyFromGzipReader(t *testing.T) {
)`).ReadAll()
require.NoError(t, err)

f, err := os.CreateTemp("", "*")
f, err := os.CreateTemp(t.TempDir(), "*")
require.NoError(t, err)
defer f.Close()

gw := gzip.NewWriter(f)

Expand Down Expand Up @@ -2137,12 +2138,6 @@ func TestConnCopyFromGzipReader(t *testing.T) {
err = gr.Close()
require.NoError(t, err)

err = f.Close()
require.NoError(t, err)

err = os.Remove(f.Name())
require.NoError(t, err)

result := pgConn.ExecParams(ctx, "select * from foo", nil, nil, nil, nil).Read()
require.NoError(t, result.Err)

Expand Down

0 comments on commit ad87d47

Please sign in to comment.