From 75e1786682aaef53db5ae74f8ae40be51e2ed373 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 23 Aug 2022 16:37:15 +1000 Subject: [PATCH] Purge IDS features from BIMTester as superseded by IfcTester --- .../blenderbim/bim/module/bimtester/prop.py | 2 +- src/ifcbimtester/bimtester/run.py | 51 ------------------- src/ifcbimtester/cli.py | 2 +- 3 files changed, 2 insertions(+), 53 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/bimtester/prop.py b/src/blenderbim/blenderbim/bim/module/bimtester/prop.py index a2ce7dad0d..2a497c2a44 100644 --- a/src/blenderbim/blenderbim/bim/module/bimtester/prop.py +++ b/src/blenderbim/blenderbim/bim/module/bimtester/prop.py @@ -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") diff --git a/src/ifcbimtester/bimtester/run.py b/src/ifcbimtester/bimtester/run.py index 7d01899a43..725c208913 100644 --- a/src/ifcbimtester/bimtester/run.py +++ b/src/ifcbimtester/bimtester/run.py @@ -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") diff --git a/src/ifcbimtester/cli.py b/src/ifcbimtester/cli.py index e0f9a50bbc..f091fc27ae 100644 --- a/src/ifcbimtester/cli.py +++ b/src/ifcbimtester/cli.py @@ -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")