mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-07 04:26:45 +00:00
💥 remove deprecated nonebot.plugins
toml table (#1151)
Feature: 移除过时的 `nonebot.plugins` toml 配置
This commit is contained in:
0
tests/plugins.empty.toml
Normal file
0
tests/plugins.empty.toml
Normal file
1
tests/plugins.invalid.json
Normal file
1
tests/plugins.invalid.json
Normal file
@ -0,0 +1 @@
|
||||
[]
|
2
tests/plugins.invalid.toml
Normal file
2
tests/plugins.invalid.toml
Normal file
@ -0,0 +1,2 @@
|
||||
[tool]
|
||||
nonebot = []
|
4
tests/plugins.json
Normal file
4
tests/plugins.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [],
|
||||
"plugin_dirs": ["plugins"]
|
||||
}
|
3
tests/plugins.toml
Normal file
3
tests/plugins.toml
Normal file
@ -0,0 +1,3 @@
|
||||
[tool.nonebot]
|
||||
plugins = []
|
||||
plugin_dirs = ["plugins"]
|
@ -3,5 +3,7 @@ from datetime import datetime, timedelta
|
||||
from nonebot.matcher import Matcher
|
||||
|
||||
test_temp_matcher = Matcher.new("test", temp=True)
|
||||
test_datetime_matcher = Matcher.new("test", expire_time=datetime.now())
|
||||
test_datetime_matcher = Matcher.new(
|
||||
"test", expire_time=datetime.now() - timedelta(seconds=1)
|
||||
)
|
||||
test_timedelta_matcher = Matcher.new("test", expire_time=timedelta(seconds=-1))
|
||||
|
@ -51,6 +51,29 @@ async def test_load_nested_plugin(app: App, load_plugin: Set["Plugin"]):
|
||||
assert parent_plugin.sub_plugins == {sub_plugin, sub_plugin2}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_load_json(app: App):
|
||||
import nonebot
|
||||
|
||||
nonebot.load_from_json("./plugins.json")
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
nonebot.load_from_json("./plugins.invalid.json")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_load_toml(app: App):
|
||||
import nonebot
|
||||
|
||||
nonebot.load_from_toml("./plugins.toml")
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
nonebot.load_from_toml("./plugins.empty.toml")
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
nonebot.load_from_toml("./plugins.invalid.toml")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bad_plugin(app: App):
|
||||
import nonebot
|
||||
|
Reference in New Issue
Block a user