mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Generate stable GlobalIds for IDS docs to prevent commit noise
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import uuid
|
||||||
import pytest
|
import pytest
|
||||||
import functools
|
import functools
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
@@ -29,6 +30,19 @@ from ifcopenshell import validate
|
|||||||
|
|
||||||
outdir = "build"
|
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:
|
class DocGenerator:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -42,6 +56,7 @@ class DocGenerator:
|
|||||||
result = "pass" if expected is True else "fail"
|
result = "pass" if expected is True else "fail"
|
||||||
|
|
||||||
f = inst.wrapped_data.file
|
f = inst.wrapped_data.file
|
||||||
|
StableUUIDGenerator.file = f
|
||||||
|
|
||||||
# Validate the file created and loop over the issues, fixing them one by one.
|
# Validate the file created and loop over the issues, fixing them one by one.
|
||||||
l = validate.json_logger()
|
l = validate.json_logger()
|
||||||
|
|||||||
Reference in New Issue
Block a user