Fix ability to run tests and segfaulting test

This commit is contained in:
Dion Moult
2024-05-11 15:00:30 +10:00
parent 371e11de9b
commit 8e6c372a4f
3 changed files with 6 additions and 8 deletions
@@ -350,7 +350,8 @@ def wrap_usecases(path, name):
module_name = name.split(".")[-1]
module = sys.modules[name]
for loader, usecase_name, is_pkg in pkgutil.iter_modules(path):
usecase = getattr(module, usecase_name)
# We may not be able to get the usecase if we are missing a dependency.
usecase = getattr(module, usecase_name, None)
if callable(usecase):
usecase_path = f"{module_name}.{usecase_name}"
setattr(module, usecase_name, wrap_usecase(usecase_path, usecase))
@@ -56,11 +56,8 @@ def add_information(
attributes={"Identification": "A-GA-6100", "Name": "Overall Plan",
"Location": "A-GA-6100 - Overall Plan.pdf"})
"""
settings = {"parent": parent}
id_attribute = "DocumentId" if file.schema == "IFC2X3" else "Identification"
information = file.create_entity("IfcDocumentInformation", **{id_attribute: "X", "Name": "Unnamed"})
parent = settings["parent"]
if not parent and file.by_type("IfcProject"):
parent = file.by_type("IfcProject")[0]
if parent.is_a("IfcProject") or parent.is_a("IfcContext"):