test unique node ids
This commit is contained in:
parent
5620c199a9
commit
0603a8c7e6
1 changed files with 14 additions and 0 deletions
14
hooks/unique_node_ids.py
Normal file
14
hooks/unique_node_ids.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
def test_unique_node_ids(repo):
|
||||
ids = {}
|
||||
for node in repo.nodes:
|
||||
if node.metadata.get('id') in ids:
|
||||
raise ValueError(f"Duplicate node ID found: {node.metadata.get('id')} in node {node.name} and {ids[node.metadata.get('id')]}")
|
||||
ids[node.metadata.get('id')] = node.name
|
||||
|
||||
|
||||
def apply_start(repo, target, nodes, interactive=False, **kwargs):
|
||||
test_unique_node_ids(repo)
|
||||
|
||||
|
||||
def test(repo, **kwargs):
|
||||
test_unique_node_ids(repo)
|
||||
Loading…
Reference in a new issue