[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

@ -4,7 +4,8 @@
from meshroom.core.graph import Graph, loadGraph, executeGraph
from meshroom.core import desc, pluginManager
from meshroom.core.node import Node
from meshroom.core.plugins import NodePlugin
from .utils import registerNodeDesc, unregisterNodeDesc
class NodeWithAttributesNeedingFormatting(desc.Node):
@ -101,15 +102,14 @@ class NodeWithAttributesNeedingFormatting(desc.Node):
]
class TestCommandLineFormatting:
nodePlugin = NodePlugin(NodeWithAttributesNeedingFormatting)
@classmethod
def setup_class(cls):
pluginManager.registerNode(cls.nodePlugin)
registerNodeDesc(NodeWithAttributesNeedingFormatting)
@classmethod
def teardown_class(cls):
pluginManager.unregisterNode(cls.nodePlugin)
unregisterNodeDesc(NodeWithAttributesNeedingFormatting)
def test_formatting_listOfFiles(self):
inputImages = ["/non/existing/fileA", "/non/existing/with space/fileB"]