mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-21 03:57:23 +02:00
[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:
parent
424abbff82
commit
3c57afb4d0
8 changed files with 76 additions and 77 deletions
|
@ -1,7 +1,8 @@
|
|||
from meshroom.core import desc, pluginManager
|
||||
from meshroom.core.node import Node
|
||||
from meshroom.core.graph import Graph, loadGraph
|
||||
from meshroom.core.plugins import NodePlugin
|
||||
|
||||
from .utils import registerNodeDesc, unregisterNodeDesc
|
||||
|
||||
|
||||
class NodeWithCreationCallback(desc.InputNode):
|
||||
|
@ -23,15 +24,14 @@ class NodeWithCreationCallback(desc.InputNode):
|
|||
|
||||
|
||||
class TestNodeCreationCallback:
|
||||
nodePlugin = NodePlugin(NodeWithCreationCallback)
|
||||
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
pluginManager.registerNode(cls.nodePlugin)
|
||||
registerNodeDesc(NodeWithCreationCallback)
|
||||
|
||||
@classmethod
|
||||
def teardown_class(cls):
|
||||
pluginManager.unregisterNode(cls.nodePlugin)
|
||||
unregisterNodeDesc(NodeWithCreationCallback)
|
||||
|
||||
def test_notTriggeredOnNodeInstantiation(self):
|
||||
node = Node(NodeWithCreationCallback.__name__)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue