Feature: 添加 httpx2 驱动器支持 (#4194)

This commit is contained in:
StarHeart
2026-09-13 23:43:34 +08:00
committed by GitHub
parent 206d31a61d
commit 92c840ef11
8 changed files with 389 additions and 16 deletions
+15
View File
@@ -56,6 +56,13 @@ async def test_adapter_connect(app: App, driver: Driver):
reason="not a server", raises=TypeError, strict=True
),
),
pytest.param(
"nonebot.drivers.httpx2:Driver",
id="httpx2",
marks=pytest.mark.xfail(
reason="not a server", raises=TypeError, strict=True
),
),
pytest.param(
"nonebot.drivers.websockets:Driver",
id="websockets",
@@ -129,6 +136,7 @@ def test_adapter_server(driver: Driver):
),
),
pytest.param("nonebot.drivers.httpx:Driver", id="httpx"),
pytest.param("nonebot.drivers.httpx2:Driver", id="httpx2"),
pytest.param(
"nonebot.drivers.websockets:Driver",
id="websockets",
@@ -182,6 +190,13 @@ async def test_adapter_http_client(driver: Driver):
reason="not a websocket client", raises=TypeError, strict=True
),
),
pytest.param(
"nonebot.drivers.httpx2:Driver",
id="httpx2",
marks=pytest.mark.xfail(
reason="not a websocket client", raises=TypeError, strict=True
),
),
pytest.param("nonebot.drivers.websockets:Driver", id="websockets"),
pytest.param("nonebot.drivers.aiohttp:Driver", id="aiohttp"),
],
+3
View File
@@ -225,6 +225,7 @@ async def test_cross_context(app: App, driver: Driver):
"driver",
[
pytest.param("nonebot.drivers.httpx:Driver", id="httpx"),
pytest.param("nonebot.drivers.httpx2:Driver", id="httpx2"),
pytest.param("nonebot.drivers.aiohttp:Driver", id="aiohttp"),
],
indirect=True,
@@ -392,6 +393,7 @@ async def test_http_client(driver: Driver, server_url: URL):
"driver",
[
pytest.param("nonebot.drivers.httpx:Driver", id="httpx"),
pytest.param("nonebot.drivers.httpx2:Driver", id="httpx2"),
pytest.param("nonebot.drivers.aiohttp:Driver", id="aiohttp"),
],
indirect=True,
@@ -733,6 +735,7 @@ def test_timeout_unset_vs_none():
"driver",
[
pytest.param("nonebot.drivers.httpx:Driver", id="httpx"),
pytest.param("nonebot.drivers.httpx2:Driver", id="httpx2"),
pytest.param("nonebot.drivers.aiohttp:Driver", id="aiohttp"),
],
indirect=True,