1
0
Fork 0
forked from forgejo/forgejo

[TESTS] tests.AddFixtures helper loads additional per-test fixtures

(cherry picked from commit 93a844dd13)
(cherry picked from commit 6d6d1a121c)
(cherry picked from commit 8b101f2860)
(cherry picked from commit 3e56212d6d)
(cherry picked from commit 4f619bc585)
(cherry picked from commit 06a47ea56e)
(cherry picked from commit 5a4d56e77b)
(cherry picked from commit 84b9d3a0c3)
This commit is contained in:
Earl Warren 2023-10-01 18:38:19 +02:00
parent 40d49b5107
commit 1eb2eca71c
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
3 changed files with 30 additions and 0 deletions

View file

@ -267,3 +267,13 @@ func PrintCurrentTest(t testing.TB, skip ...int) func() {
func Printf(format string, args ...any) {
testlogger.Printf(format, args...)
}
func AddFixtures(dirs ...string) func() {
return unittest.OverrideFixtures(
unittest.FixturesOptions{
Dir: filepath.Join(filepath.Dir(setting.AppPath), "models/fixtures/"),
Base: filepath.Dir(setting.AppPath),
Dirs: dirs,
},
)
}