diff --git a/nonebot_plugin_resolver2/download/common.py b/nonebot_plugin_resolver2/download/common.py index 8527f1b..927728b 100644 --- a/nonebot_plugin_resolver2/download/common.py +++ b/nonebot_plugin_resolver2/download/common.py @@ -1,6 +1,5 @@ import os import re -import json import time import httpx import hashlib diff --git a/pyproject.toml b/pyproject.toml index 1821cb4..cde03c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ tqdm = "^4.66.5" fake-useragent = "1.5.1" tenacity = "^9.0.0" aiofiles = "^24.1.0" -yt-dlp = ">=2024.12.23" +yt-dlp = ">=2025.1.15" nonebot2 = "^2.4.0" nonebot-adapter-onebot = "^2.4.6" nonebot-plugin-localstore = ">=0.7.0,<1.0.0" diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index 007108b..0000000 --- a/tests/conftest.py +++ /dev/null @@ -1,28 +0,0 @@ -import os -import pytest -import nonebot -from pytest_asyncio import is_async_test -# 导入适配器 -from nonebot.adapters.onebot.v11 import Adapter as OnebotAdapter -from nonebug import NONEBOT_INIT_KWARGS - -os.environ["ENVIRONMENT"] = "test" - -def pytest_configure(config: pytest.Config): - config.stash[NONEBOT_INIT_KWARGS] = {"secret": os.getenv("INPUT_SECRET")} - -def pytest_collection_modifyitems(items: list[pytest.Item]): - pytest_asyncio_tests = (item for item in items if is_async_test(item)) - session_scope_marker = pytest.mark.asyncio(loop_scope="session") - for async_test in pytest_asyncio_tests: - async_test.add_marker(session_scope_marker, append=False) - -@pytest.fixture(scope="session", autouse=True) -async def after_nonebot_init(after_nonebot_init: None): - # 加载适配器 - driver = nonebot.get_driver() - driver.register_adapter(OnebotAdapter) - - # 加载插件 - nonebot.load_from_toml("pyproject.toml") - \ No newline at end of file diff --git a/tests/test_bilibili.py b/tests/test_bilibili.py deleted file mode 100644 index 368a967..0000000 --- a/tests/test_bilibili.py +++ /dev/null @@ -1,32 +0,0 @@ -import pytest -from nonebug import App - -@pytest.mark.asyncio -async def test_bilibili(app: App): - import time - from nonebot_plugin_resolver2.matchers.bilibili import bilibili - from nonebot.adapters.onebot.v11 import Adapter, Bot, MessageEvent, Message - - event = MessageEvent( - time=int(time.time()), - self_id=123456789, - post_type="message", - sub_type="normal", - message_type="group", - message_id=12354678, - raw_message="BV1584y167sD 40", - message=Message("BV1584y167sD 40"), - user_id=1234567890, - group_id=12345678, - sender={}, - font=15 - ) - async with app.test_matcher(bilibili) as ctx: - adapter = nonebot.get_adapter(Adapter) - bot = ctx.create_bot(base=Bot, adapter=adapter) - ctx.receive_event(bot, event) - ctx.should_call_send(event, '解析 | 哔哩哔哩 - 视频', result=None) - ctx.should_call_send(event, None, result=None) - ctx.should_call_send(event, None, result=None) - ctx.should_finished(bilibili) -