Skip to content

Commit 54caa31

Browse files
committed
Prevent init from registering drivers if testing
1 parent 4abee23 commit 54caa31

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

driver/driver.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"sort"
77
"strings"
88
"sync"
9+
"testing"
910

1011
"github.com/go-sql-driver/mysql"
1112
"github.com/jackc/pgx/v4/stdlib"
@@ -47,7 +48,9 @@ var (
4748
)
4849

4950
func init() { //nolint:gochecknoinits
50-
registerAllDrivers()
51+
if !testing.Testing() {
52+
registerAllDrivers()
53+
}
5154
}
5255

5356
// Register registers a DB driver

0 commit comments

Comments
 (0)