Bonjour,
The following test file
package foobar
import (
"path/filepath"
"testing"
// "code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/unittest"
"github.com/stretchr/testify/assert"
)
//var _ models.AccessMode
func TestMain(m *testing.M) {
unittest.MainTest(m, filepath.Join("..", ".."))
}
func TestFoobar(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
}
fails with:
=== RUN TestFoobar
LoadFixtures failed after retries: testfixtures: could not clean table "access": no such table: access
foobar_test.go:19:
Error Trace: foobar_test.go:19
Error: Received unexpected error:
testfixtures: could not clean table "access": no such table: access
Test: TestFoobar
--- FAIL: TestFoobar (4.02s)
FAIL
FAIL code.gitea.io/gitea/modules/foobar 4.110s
But it works when models
is imported (uncomment in the above).
=== RUN TestFoobar
--- PASS: TestFoobar (0.01s)
PASS
ok code.gitea.io/gitea/modules/foobar 0.116s
Why is that?