<commit_before>package sql

import (
	"bufio"
	"database/sql"
	"fmt"
	"os"
	"testing"
	"time"

	"github.com/go-sql-driver/mysql"
	_ "github.com/mattn/go-sqlite3"
)

var (
	testCfg *mysql.Config
	testDB  *sql.DB
)

func TestMain(m *testing.M) {
	dbms := os.Getenv("SQLFLOW_TEST_DB")
	if dbms == "" {
		dbms = "sqlite3"
	}

	var e error
	switch dbms {
	case "sqlite3":
		testDB, testCfg, e = openSQLite3()
		defer testDB.Close()
	case "mysql":
		testDB, testCfg, e = openMySQL()
		defer testDB.Close()
	default:
		e = fmt.Errorf("Unrecognized environment variable SQLFLOW_TEST_DB %s\n", dbms)
	}
	assertNoErr(e)

	assertNoErr(popularize(testDB, "testdata/iris.sql"))
	assertNoErr(popularize(testDB, "testdata/churn.sql"))

	os.Exit(m.Run())
}

// assertNoError prints the error if there is any in TestMain, which
// log doesn't work.
func assertNoErr(e error) {
	if e != nil {
		fmt.Println(e)
		os.Exit(-1)
	}
}<commit_msg>Use mysql as default value<commit_after>package sql

import (
	"bufio"
	"database/sql"
	"fmt"
	"os"
	"testing"
	"time"

	"github.com/go-sql-driver/mysql"
	_ "github.com/mattn/go-sqlite3"
)

var (
	testCfg *mysql.Config
	testDB  *sql.DB
)

func TestMain(m *testing.M) {
	dbms := os.Getenv("SQLFLOW_TEST_DB")
	if dbms == "" {
		dbms = "mysql"
	}

	var e error
	switch dbms {
	case "sqlite3":
		testDB, testCfg, e = openSQLite3()
		defer testDB.Close()
	case "mysql":
		testDB, testCfg, e = openMySQL()
		defer testDB.Close()
	default:
		e = fmt.Errorf("Unrecognized environment variable SQLFLOW_TEST_DB %s\n", dbms)
	}
	assertNoErr(e)

	assertNoErr(popularize(testDB, "testdata/iris.sql"))
	assertNoErr(popularize(testDB, "testdata/churn.sql"))

	os.Exit(m.Run())
}

// assertNoError prints the error if there is any in TestMain, which
// log doesn't work.
func assertNoErr(e error) {
	if e != nil {
		fmt.Println(e)
		os.Exit(-1)
	}
}
{'fraction_non_alphanumeric': 0.15202156334231806, 'fraction_numerical': 0.004851752021563342, 'mean_word_length': 3.8713910761154855, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4842813', 'n_tokens_mistral': 809, 'n_tokens_neox': 775, 'n_words': 168}