mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Purge IDS features from BIMTester as superseded by IfcTester
This commit is contained in:
@@ -62,7 +62,7 @@ def refreshScenarios(self, context):
|
||||
|
||||
|
||||
class BimTesterProperties(PropertyGroup):
|
||||
feature: StringProperty(default="", name="Feature / IDS", update=refreshScenarios)
|
||||
feature: StringProperty(default="", name="Feature", update=refreshScenarios)
|
||||
steps: StringProperty(default="", name="Custom Steps")
|
||||
ifc_file: StringProperty(default="", name="IFC File")
|
||||
audit_ifc_class: EnumProperty(items=get_ifc_classes, name="Audit Class")
|
||||
|
||||
@@ -38,39 +38,6 @@ from behave.__main__ import main as behave_main
|
||||
from logging import StreamHandler
|
||||
|
||||
|
||||
class IDSHandler(StreamHandler):
|
||||
def __init__(self):
|
||||
StreamHandler.__init__(self)
|
||||
self.results = {
|
||||
"name": "Specification name",
|
||||
"status": "passed",
|
||||
"location": "filename.xml",
|
||||
"elements": [
|
||||
{"keyword": "Scenario", "name": "Checking IDS specifications", "status": "passed", "steps": []}
|
||||
],
|
||||
}
|
||||
|
||||
def emit(self, record):
|
||||
msg = self.format(record)
|
||||
# Obviously, not a final product
|
||||
is_fail = "is compliant" not in msg
|
||||
if is_fail:
|
||||
self.results["status"] = "failed"
|
||||
self.results["elements"][0]["status"] = "failed"
|
||||
self.results["elements"][0]["steps"].append(
|
||||
{
|
||||
"keyword": "*",
|
||||
"match": {},
|
||||
"name": msg,
|
||||
"result": {
|
||||
"duration": 0.0,
|
||||
"error_message": "Assertion Failed",
|
||||
"status": "failed" if is_fail else "passed",
|
||||
},
|
||||
"step_type": "given",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class TestRunner:
|
||||
def __init__(self, ifc_path, schema_path=None, ifc=None):
|
||||
@@ -92,26 +59,8 @@ class TestRunner:
|
||||
self.locale_path = os.path.join(self.base_path, "locale")
|
||||
|
||||
def run(self, args):
|
||||
if args["feature"][-4:].lower() == ".xml":
|
||||
return self.test_ids(args)
|
||||
return self.test_feature(args)
|
||||
|
||||
def test_ids(self, args):
|
||||
# Local import whilst this is experimental
|
||||
import ifcopenshell.ids
|
||||
|
||||
logger = logging.getLogger("IDS")
|
||||
logging.basicConfig(level=logging.INFO, format="%(message)s")
|
||||
ids_handler = IDSHandler()
|
||||
logger.addHandler(ids_handler)
|
||||
ids_file = ifcopenshell.ids.ids.open(args["feature"])
|
||||
ids_file.validate(IfcStore.file, logger)
|
||||
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
report_json = os.path.join(tmpdir, "report.json")
|
||||
json.dump([ids_handler.results], open(report_json, "w"))
|
||||
return report_json
|
||||
|
||||
def test_feature(self, args):
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
features_path = os.path.join(tmpdir, "features")
|
||||
|
||||
@@ -29,7 +29,7 @@ parser = argparse.ArgumentParser(description="Runs unit tests for BIM data")
|
||||
parser.add_argument("-a", "--action", type=str, help="Action to perform, from run/purge", default="run")
|
||||
parser.add_argument("--advanced-arguments", type=str, help="Specify arguments to Behave", default="")
|
||||
parser.add_argument("-c", "--console", action="store_true", help="Show results in the console")
|
||||
parser.add_argument("-f", "--feature", type=str, help="Specify a feature file or IDS to test", required=True)
|
||||
parser.add_argument("-f", "--feature", type=str, help="Specify a feature file to test", required=True)
|
||||
parser.add_argument("-i", "--ifc", type=str, help="Specify an IFC file to test", required=True)
|
||||
parser.add_argument("-p", "--path", type=str, help="Define a path for use in test steps that use relative paths")
|
||||
parser.add_argument("-r", "--report", type=str, help="Specify an output file for a HTML report")
|
||||
|
||||
Reference in New Issue
Block a user