fixed # 修复astrbot日志未使用logging.basicConfig

This commit is contained in:
2026-10-27 11:40:59 +08:00
parent b3455ded58
commit d05b2e5765
20 changed files with 333 additions and 46 deletions
+8 -1
View File
@@ -1,8 +1,10 @@
import asyncio
import importlib.util
from pathlib import Path
import sys
from types import ModuleType
import unittest
from unittest.mock import AsyncMock, patch
from unittest.mock import AsyncMock, Mock, patch
ROOT = Path(__file__).resolve().parents[1]
@@ -10,6 +12,11 @@ ROOT = Path(__file__).resolve().parents[1]
class AvatarTests(unittest.IsolatedAsyncioTestCase):
def setUp(self):
api = ModuleType('astrbot.api')
api.logger = Mock()
host = patch.dict(sys.modules, {'astrbot.api': api})
host.start()
self.addCleanup(host.stop)
spec = importlib.util.spec_from_file_location(
'farm_astrbot_avatars',
ROOT / 'integrations/astrbot/avatars.py',