mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-28 09:47:20 +02:00
[tests] Remove test_templatesVersion
This test checked that every node in all the available templates was free of any compatibility issue. As templates are not provided with Meshroom, it is not needed anymore.
This commit is contained in:
parent
752b63054d
commit
2fe7cfe95e
1 changed files with 0 additions and 61 deletions
|
@ -1,61 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# coding:utf-8
|
||||
|
||||
from meshroom.core.graph import Graph
|
||||
from meshroom.core import pipelineTemplates, Version
|
||||
from meshroom.core.node import CompatibilityIssue, CompatibilityNode
|
||||
from meshroom.core.graphIO import GraphIO
|
||||
|
||||
import json
|
||||
import meshroom
|
||||
|
||||
|
||||
def test_templateVersions():
|
||||
"""
|
||||
This test checks that there is no compatibility issue with the nodes saved in the template files.
|
||||
It fails when an upgrade of a templates is needed. Any template can still be opened even if its
|
||||
nodes are not up-to-date, as they will be automatically upgraded.
|
||||
"""
|
||||
meshroom.core.initNodes()
|
||||
meshroom.core.initPipelines()
|
||||
|
||||
assert len(pipelineTemplates) >= 1
|
||||
|
||||
for _, path in pipelineTemplates.items():
|
||||
with open(path) as jsonFile:
|
||||
fileData = json.load(jsonFile)
|
||||
|
||||
graphData = fileData.get(GraphIO.Keys.Graph, fileData)
|
||||
|
||||
assert isinstance(graphData, dict)
|
||||
|
||||
header = fileData.get(GraphIO.Keys.Header, {})
|
||||
assert header.get("template", False)
|
||||
nodesVersions = header.get(GraphIO.Keys.NodesVersions, {})
|
||||
|
||||
for _, nodeData in graphData.items():
|
||||
nodeType = nodeData["nodeType"]
|
||||
assert nodeType in meshroom.core.nodesDesc
|
||||
|
||||
nodeDesc = meshroom.core.nodesDesc[nodeType]
|
||||
currentNodeVersion = meshroom.core.nodeVersion(nodeDesc)
|
||||
|
||||
inputs = nodeData.get("inputs", {})
|
||||
internalInputs = nodeData.get("internalInputs", {})
|
||||
version = nodesVersions.get(nodeType, None)
|
||||
|
||||
compatibilityIssue = None
|
||||
|
||||
if version and currentNodeVersion and Version(version).major != Version(currentNodeVersion).major:
|
||||
compatibilityIssue = CompatibilityIssue.VersionConflict
|
||||
else:
|
||||
for attrName, value in inputs.items():
|
||||
if not CompatibilityNode.attributeDescFromName(nodeDesc.inputs, attrName, value):
|
||||
compatibilityIssue = CompatibilityIssue.DescriptionConflict
|
||||
break
|
||||
for attrName, value in internalInputs.items():
|
||||
if not CompatibilityNode.attributeDescFromName(nodeDesc.internalInputs, attrName, value):
|
||||
compatibilityIssue = CompatibilityIssue.DescriptionConflict
|
||||
break
|
||||
|
||||
assert compatibilityIssue is None, "{} in {} for node {}".format(compatibilityIssue, path, nodeType)
|
Loading…
Add table
Reference in a new issue