Decouple unit test, remove intermediate unittestbridge package (#17662)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
wxiaoguang 2021-11-16 16:53:21 +08:00 committed by GitHub
parent 23bd7b1211
commit 81926d61db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
151 changed files with 1719 additions and 1781 deletions

View file

@ -18,7 +18,6 @@ import (
"code.gitea.io/gitea/modules/util"
"github.com/stretchr/testify/assert"
"xorm.io/xorm"
"xorm.io/xorm/names"
)
@ -43,7 +42,7 @@ func fatalTestError(fmtStr string, args ...interface{}) {
// test database. Creates the test database, and sets necessary settings.
func MainTest(m *testing.M, pathToGiteaRoot string, fixtureFiles ...string) {
var err error
InitUnitTestBridge()
giteaRoot = pathToGiteaRoot
fixturesDir = filepath.Join(pathToGiteaRoot, "models", "fixtures")
@ -125,7 +124,7 @@ func CreateTestEngine(opts FixturesOptions) error {
return err
}
x.SetMapper(names.GonicMapper{})
db.SetUnitTestEngine(x)
db.SetEngine(x)
if err = db.SyncAllTables(); err != nil {
return err