mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-16 19:11:00 +00:00
⚗️ new driver combine expr support
This commit is contained in:
@ -15,18 +15,24 @@ os.environ["CONFIG_FROM_ENV"] = '{"test": "test"}'
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
"nonebug_init",
|
||||
[{"config_from_init": "init", "driver": "nonebot.drivers.fastapi:FullDriver"}],
|
||||
[
|
||||
{
|
||||
"config_from_init": "init",
|
||||
"driver": "nonebot.drivers.fastapi+nonebot.drivers.httpx+nonebot.drivers.websockets",
|
||||
},
|
||||
{
|
||||
"config_from_init": "init",
|
||||
"driver": "~fastapi+~httpx+~websockets",
|
||||
},
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
async def test_init(nonebug_init):
|
||||
from nonebot import get_driver
|
||||
from nonebot.drivers.fastapi import FullDriver
|
||||
|
||||
env = get_driver().env
|
||||
assert env == "test"
|
||||
|
||||
assert isinstance(get_driver(), FullDriver)
|
||||
|
||||
config = get_driver().config
|
||||
assert config.config_from_env == {"test": "test"}
|
||||
assert config.config_from_init == "init"
|
||||
|
Reference in New Issue
Block a user