mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-04 02:26:11 +08:00
🐛 更改标注类型的格式
This commit is contained in:
parent
28f5d0c55d
commit
2d8b138e86
@ -72,7 +72,7 @@ def register_get_token_handler():
|
|||||||
get_token.__help__info__ = "获取管理bot后台的地址,该地址会在一段时间过后过期,请不要泄漏该地址" # type: ignore
|
get_token.__help__info__ = "获取管理bot后台的地址,该地址会在一段时间过后过期,请不要泄漏该地址" # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def check_driver_is_fastapi() -> "Driver" | None:
|
def check_driver_is_fastapi() -> "Driver | None":
|
||||||
try:
|
try:
|
||||||
from nonebot.drivers.fastapi import Driver
|
from nonebot.drivers.fastapi import Driver
|
||||||
|
|
||||||
|
@ -42,15 +42,20 @@ async def test_log(app: App, tmp_path: Path):
|
|||||||
import io
|
import io
|
||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
|
from nonebot import get_driver
|
||||||
|
from nonebot.drivers.fastapi import Driver
|
||||||
from nonebot.log import logger, default_format
|
from nonebot.log import logger, default_format
|
||||||
|
|
||||||
from nonebot_bison.admin_page import init_fastapi
|
from nonebot_bison.admin_page import init_fastapi
|
||||||
|
|
||||||
|
driver = get_driver()
|
||||||
|
assert isinstance(driver, Driver)
|
||||||
|
|
||||||
log_path = tmp_path / "temp.log"
|
log_path = tmp_path / "temp.log"
|
||||||
|
|
||||||
logger.add(log_path, level="INFO", format=default_format, rotation="1 day")
|
logger.add(log_path, level="INFO", format=default_format, rotation="1 day")
|
||||||
with contextlib.redirect_stderr(io.StringIO()) as f:
|
with contextlib.redirect_stderr(io.StringIO()) as f:
|
||||||
init_fastapi()
|
init_fastapi(driver)
|
||||||
|
|
||||||
with log_path.open("r", encoding="utf-8") as f:
|
with log_path.open("r", encoding="utf-8") as f:
|
||||||
log = f.read()
|
log = f.read()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user