mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-16 02:50:48 +00:00
✅ add pytest
This commit is contained in:
19
tests/test_init.py
Normal file
19
tests/test_init.py
Normal file
@ -0,0 +1,19 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
os.environ["CONFIG_FROM_ENV"] = "env"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("nonebug_init", [{"config_from_init": "init"}], indirect=True)
|
||||
async def test_init(nonebug_init):
|
||||
from nonebot import get_driver
|
||||
|
||||
env = get_driver().env
|
||||
assert env == "test"
|
||||
|
||||
config = get_driver().config
|
||||
assert config.config_from_env == "env"
|
||||
assert config.config_from_init == "init"
|
||||
assert config.common_config == "common"
|
Reference in New Issue
Block a user