mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
🐛 修复测试
This commit is contained in:
parent
08721ad219
commit
07ea6b060e
169
poetry.lock
generated
169
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -41,9 +41,9 @@ python-jose = { extras = ["cryptography"], version = "^3.3.0" }
|
||||
python-multipart = "^0.0.9"
|
||||
aiocache = "^0.12.2"
|
||||
py-cpuinfo = "^9.0.0"
|
||||
nonebot-plugin-uninfo = "^0.4.1"
|
||||
nonebot-plugin-alconna = "^0.54.0"
|
||||
tenacity = "^9.0.0"
|
||||
nonebot-plugin-uninfo = ">0.4.1"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
nonebug = "^0.4"
|
||||
|
||||
@ -12,7 +12,7 @@ from pytest_asyncio import is_async_test
|
||||
from pytest_mock import MockerFixture
|
||||
from respx import MockRouter
|
||||
|
||||
from tests.config import BotId, UserId
|
||||
from tests.config import BotId, GroupId, UserId
|
||||
|
||||
nonebot.load_plugin("nonebot_plugin_session")
|
||||
|
||||
@ -64,6 +64,37 @@ def _init_bot(nonebug_init: None):
|
||||
nonebot.load_plugins("zhenxun/builtin_plugins")
|
||||
nonebot.load_plugins("zhenxun/plugins")
|
||||
|
||||
# 手动缓存 uninfo 所需信息
|
||||
from nonebot_plugin_uninfo import (
|
||||
Scene,
|
||||
SceneType,
|
||||
Session,
|
||||
SupportAdapter,
|
||||
SupportScope,
|
||||
User,
|
||||
)
|
||||
from nonebot_plugin_uninfo.adapters.onebot11.main import fetcher as onebot11_fetcher
|
||||
from nonebot_plugin_uninfo.adapters.onebot12.main import fetcher as onebot12_fetcher
|
||||
|
||||
onebot11_fetcher.session_cache = {
|
||||
f"group_{GroupId.GROUP_ID_LEVEL_5}_{UserId.SUPERUSER}": Session(
|
||||
self_id="test",
|
||||
adapter=SupportAdapter.onebot11,
|
||||
scope=SupportScope.qq_client,
|
||||
scene=Scene(str(GroupId.GROUP_ID_LEVEL_0), SceneType.GROUP),
|
||||
user=User(str(UserId.SUPERUSER)),
|
||||
),
|
||||
}
|
||||
onebot12_fetcher.session_cache = {
|
||||
f"group_{GroupId.GROUP_ID_LEVEL_5}_{UserId.SUPERUSER}": Session(
|
||||
self_id="test",
|
||||
adapter=SupportAdapter.onebot12,
|
||||
scope=SupportScope.qq_client,
|
||||
scene=Scene(str(GroupId.GROUP_ID_LEVEL_0), SceneType.GROUP),
|
||||
user=User(str(UserId.SUPERUSER)),
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def app(app: App, tmp_path: Path, mocker: MockerFixture):
|
||||
|
||||
@ -249,6 +249,7 @@ class ShopManage:
|
||||
else:
|
||||
# 安装依赖
|
||||
plugin_path = base_path / "/".join(module_path.split("."))
|
||||
try:
|
||||
req_files = repo_api.get_files(
|
||||
f"{replace_module_path}/{REQ_TXT_FILE_STRING}", False
|
||||
)
|
||||
@ -270,8 +271,10 @@ class ShopManage:
|
||||
raise Exception("插件依赖文件下载失败")
|
||||
logger.debug(f"插件依赖文件列表: {req_paths}", "插件管理")
|
||||
install_requirement(plugin_path)
|
||||
except ValueError as e:
|
||||
logger.warning("未获取到依赖文件路径...", e=e)
|
||||
return True
|
||||
raise Exception("插件下载失败")
|
||||
raise Exception("插件下载失败...")
|
||||
|
||||
@classmethod
|
||||
async def remove_plugin(cls, plugin_id: str) -> str:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user