[tests] Simplify registration/unregistration of nodes in tests

Add two methods that are local to tests, `registerNodeDesc` and
`unregisterNodeDesc`, which handle the registration and unregistration
of `NodePlugins` from a node description. This reduces the amount of
code in tests whenever `NodePlugin` need to be instantiated prior
to their registration and so on.
This commit is contained in:
Candice Bentéjac 2025-06-04 21:18:16 +02:00
parent 424abbff82
commit 3c57afb4d0
8 changed files with 76 additions and 77 deletions

View file

@ -3,7 +3,6 @@
from meshroom.core import desc, pluginManager, loadClassesNodes
from meshroom.core.plugins import NodePluginStatus, Plugin
from itertools import islice
import os
class TestPluginWithValidNodesOnly:
@ -21,7 +20,8 @@ class TestPluginWithValidNodesOnly:
@classmethod
def teardown_class(cls):
pluginManager.unregisterPlugin(cls.plugin)
for node in cls.plugin.nodes.values():
pluginManager.unregisterNode(node)
cls.plugin = None
def test_loadedPlugin(self):
@ -127,7 +127,8 @@ class TestPluginWithInvalidNodes:
@classmethod
def teardown_class(cls):
pluginManager.unregisterPlugin(cls.plugin)
for node in cls.plugin.nodes.values():
pluginManager.unregisterNode(node)
cls.plugin = None
def test_loadedPlugin(self):