improve plugin system (#1011)

This commit is contained in:
Ju4tCode
2022-05-26 16:35:47 +08:00
committed by GitHub
parent 579839f2a4
commit fa3ed2b58c
15 changed files with 254 additions and 106 deletions

1
tests/plugins/_hidden.py Normal file
View File

@ -0,0 +1 @@
assert False

View File

@ -3,4 +3,4 @@ from nonebot import export
@export()
def test():
...
return "export"

View File

@ -0,0 +1,6 @@
from pathlib import Path
import nonebot
_sub_plugins = set()
_sub_plugins |= nonebot.load_plugins(str((Path(__file__).parent / "plugins").resolve()))

View File

@ -1,8 +1,7 @@
from nonebot import require
from plugins.export import test
from .export import test as test_related
test_require = require("export").test
assert test is test_related and test is test_require, "Export Require Error"
from plugins.export import test
assert test is test_require and test() == "export", "Export Require Error"