mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-12 18:25:24 +00:00
clean up paths
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/auth/password/hash"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
var giteaTestSourceRoot *string
|
||||
@@ -50,7 +51,11 @@ func SetupGiteaTestEnv() {
|
||||
}
|
||||
|
||||
initGiteaPaths := func() {
|
||||
StaticRootPath = *giteaTestSourceRoot // need to load assets (options, public) from the source code directory for testing
|
||||
// need to load assets (options, public) from the source code directory for testing
|
||||
StaticRootPath = *giteaTestSourceRoot
|
||||
// during testing, the AppPath must point to the pre-built Gitea binary in the source root
|
||||
// it needs to be called by git hooks
|
||||
AppPath = filepath.Join(*giteaTestSourceRoot, "gitea") + util.Iif(IsWindows, ".exe", "")
|
||||
}
|
||||
|
||||
initGiteaConf := func() string {
|
||||
|
||||
@@ -95,7 +95,7 @@ func testMain(m *testing.M) int {
|
||||
|
||||
err = unittest.InitFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(filepath.Dir(setting.AppPath), "models/fixtures/"),
|
||||
Dir: filepath.Join(setting.GetGiteaTestSourceRoot(), "models/fixtures/"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -40,7 +40,7 @@ func initMigrationTest(t *testing.T) func() {
|
||||
setting.SetupGiteaTestEnv()
|
||||
|
||||
assert.NotEmpty(t, setting.RepoRootPath)
|
||||
assert.NoError(t, unittest.SyncDirs(filepath.Join(filepath.Dir(setting.AppPath), "tests/gitea-repositories-meta"), setting.RepoRootPath))
|
||||
assert.NoError(t, unittest.SyncDirs(filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/gitea-repositories-meta"), setting.RepoRootPath))
|
||||
assert.NoError(t, git.InitFull())
|
||||
setting.LoadDBSetting()
|
||||
setting.InitLoggersForTest()
|
||||
|
||||
@@ -156,7 +156,7 @@ func PrepareGitRepoDirectory(t testing.TB) {
|
||||
if !assert.NotEmpty(t, setting.RepoRootPath) {
|
||||
return
|
||||
}
|
||||
assert.NoError(t, unittest.SyncDirs(filepath.Join(filepath.Dir(setting.AppPath), "tests/gitea-repositories-meta"), setting.RepoRootPath))
|
||||
assert.NoError(t, unittest.SyncDirs(filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/gitea-repositories-meta"), setting.RepoRootPath))
|
||||
}
|
||||
|
||||
func PrepareArtifactsStorage(t testing.TB) {
|
||||
|
||||
Reference in New Issue
Block a user