Skip to content

Commit

Permalink
fix(plugin_test): 修复 NoneBot 2.3.0 添加的 HTTP 客户端会话支持导致测试失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
shoucandanghehe committed May 1, 2024
1 parent fe97955 commit 5837d88
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/utils/plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,24 @@
MODULE_NAME_PATTERN = re.compile(ISSUE_PATTERN.format("插件 import 包名"))
CONFIG_PATTERN = re.compile(r"### 插件配置项\s+```(?:\w+)?\s?([\s\S]*?)```")

FAKE_SCRIPT = """from nonebot import logger
FAKE_SCRIPT = """from typing import Optional, Union
from nonebot import logger
from nonebot.drivers import (
ASGIMixin,
HTTPClientMixin,
HTTPClientSession,
HTTPVersion,
Request,
Response,
WebSocketClientMixin,
)
from nonebot.drivers import Driver as BaseDriver
from nonebot.internal.driver.model import (
CookieTypes,
HeaderTypes,
QueryTypes,
)
from typing_extensions import override
Expand Down Expand Up @@ -81,6 +90,18 @@ async def request(self, setup: Request) -> Response:
@override
async def websocket(self, setup: Request) -> Response:
raise NotImplementedError
@override
def get_session(
self,
params: QueryTypes = None,
headers: HeaderTypes = None,
cookies: CookieTypes = None,
version: Union[str, HTTPVersion] = HTTPVersion.H11,
timeout: Optional[float] = None,
proxy: Optional[str] = None,
) -> HTTPClientSession:
raise NotImplementedError
"""

RUNNER_SCRIPT = """import json
Expand Down

0 comments on commit 5837d88

Please sign in to comment.