2022-05-26 16:35:47 +08:00
|
|
|
import pytest
|
|
|
|
|
2024-04-20 14:47:12 +08:00
|
|
|
from nonebot.plugin import PluginManager, _managers
|
2022-05-26 16:35:47 +08:00
|
|
|
|
|
|
|
|
2023-02-22 23:32:48 +08:00
|
|
|
@pytest.mark.asyncio
|
|
|
|
async def test_load_plugin_name():
|
|
|
|
m = PluginManager(plugins=["dynamic.manager"])
|
2024-04-20 14:47:12 +08:00
|
|
|
_managers.append(m)
|
|
|
|
|
|
|
|
# load by plugin id
|
2023-02-22 23:32:48 +08:00
|
|
|
module1 = m.load_plugin("manager")
|
2024-04-20 14:47:12 +08:00
|
|
|
# load by module name
|
2023-02-22 23:32:48 +08:00
|
|
|
module2 = m.load_plugin("dynamic.manager")
|
2024-04-20 14:47:12 +08:00
|
|
|
assert module1
|
|
|
|
assert module2
|
2022-05-26 16:35:47 +08:00
|
|
|
assert module1 is module2
|