diff --git a/src/ifctester/test/ids_doc_generator.py b/src/ifctester/test/ids_doc_generator.py index c278fb81aa..4fb16053d6 100644 --- a/src/ifctester/test/ids_doc_generator.py +++ b/src/ifctester/test/ids_doc_generator.py @@ -18,6 +18,7 @@ import os import re +import uuid import pytest import functools import ifcopenshell @@ -29,6 +30,19 @@ from ifcopenshell import validate outdir = "build" +class StableUUIDGenerator: + file = None + + @classmethod + def generate(cls): + ns = uuid.UUID('b59aa156-82a4-4b4c-a6e5-3d04a0236af9') + if cls.file: + return ifcopenshell.guid.compress(uuid.uuid5(ns, str(cls.file.wrapped_data.getMaxId())).hex) + return ifcopenshell.guid.compress(uuid.uuid4().hex) + +# Just for aesthetics so we don't keep on getting brand new GlobalIds on each generation +ifcopenshell.guid.new = StableUUIDGenerator.generate + class DocGenerator: def __init__(self): @@ -42,6 +56,7 @@ class DocGenerator: result = "pass" if expected is True else "fail" f = inst.wrapped_data.file + StableUUIDGenerator.file = f # Validate the file created and loop over the issues, fixing them one by one. l = validate.json_logger()