mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	make writing main test easier (#27270)
This PR removed `unittest.MainTest` the second parameter `TestOptions.GiteaRoot`. Now it detects the root directory by current working directory. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		@@ -4,7 +4,6 @@
 | 
			
		||||
package webhook
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/gitea/models/unittest"
 | 
			
		||||
@@ -19,7 +18,6 @@ func TestMain(m *testing.M) {
 | 
			
		||||
	// for tests, allow only loopback IPs
 | 
			
		||||
	setting.Webhook.AllowedHostList = hostmatcher.MatchBuiltinLoopback
 | 
			
		||||
	unittest.MainTest(m, &unittest.TestOptions{
 | 
			
		||||
		GiteaRootPath: filepath.Join("..", ".."),
 | 
			
		||||
		SetUp: func() error {
 | 
			
		||||
			setting.LoadQueueSettings()
 | 
			
		||||
			return Init()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user