Skip to content

Commit ad2bf54

Browse files
committed
[tests] utils: Add context manager registering a folder of plugins
1 parent 5dda2ac commit ad2bf54

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/utils.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
from unittest.mock import patch
33

44
import meshroom
5-
from meshroom.core import desc, pluginManager
5+
from meshroom.core import desc, pluginManager, loadPluginFolder
66
from meshroom.core.plugins import NodePlugin, NodePluginStatus
77

8+
import os
89

910
@contextmanager
1011
def registeredNodeTypes(nodeTypes: list[desc.Node]):
@@ -45,3 +46,13 @@ def unregisterNodeDesc(nodeDesc: desc.Node):
4546
plugin = pluginManager.getRegisteredNodePlugin(name)
4647
plugin.status = NodePluginStatus.NOT_LOADED
4748
del pluginManager._nodePlugins[name]
49+
50+
@contextmanager
51+
def registeredPlugins(folder: str):
52+
folder = os.path.join(os.path.dirname(__file__), "plugins")
53+
plugins = loadPluginFolder(folder)
54+
55+
yield
56+
57+
for plugin in plugins:
58+
pluginManager.removePlugin(plugin)

0 commit comments

Comments
 (0)