mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Minor fix
This commit is contained in:
@@ -14,14 +14,10 @@ from behave.__main__ import main as behave_main
|
||||
|
||||
|
||||
class TestRunner:
|
||||
def __init__(self, ifc_path, ifc=None, schema=None):
|
||||
def __init__(self, ifc_path, ifc=None):
|
||||
IfcStore.path = ifc_path
|
||||
IfcStore.file = ifc if ifc else ifcopenshell.open(ifc_path)
|
||||
|
||||
if schema:
|
||||
schema = ifcopenshell.express.parse(path)
|
||||
ifcopenshell.register_schema(schema)
|
||||
|
||||
try:
|
||||
# PyInstaller creates a temp folder and stores path in _MEIPASS
|
||||
self.base_path = sys._MEIPASS
|
||||
@@ -31,6 +27,10 @@ class TestRunner:
|
||||
self.locale_path = os.path.join(self.base_path, "locale")
|
||||
|
||||
def run(self, args):
|
||||
if args["schema_file"]:
|
||||
schema = ifcopenshell.express.parse(args["schema_file"])
|
||||
ifcopenshell.register_schema(args["schema_name"])
|
||||
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
features_path = os.path.join(tmpdir, "features")
|
||||
steps_path = os.path.join(features_path, "steps")
|
||||
|
||||
@@ -11,17 +11,18 @@ parser.add_argument("-a", "--action", type=str, help="Action to perform, from ru
|
||||
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 to test", required=True)
|
||||
parser.add_argument("-i", "--ifc", type=str, help="Specify a ifc file", required=True)
|
||||
parser.add_argument("-p", "--path", type=str, help="Define a path for use in tests")
|
||||
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")
|
||||
parser.add_argument("--steps", type=str, help="Specify custom step definitions")
|
||||
parser.add_argument("--schema", type=str, help="Specify an output file for a HTML report")
|
||||
parser.add_argument("--lang", type=str, help="Specify a language", default="")
|
||||
parser.add_argument("--steps", type=str, help="Specify a custom step definition Python file or directory")
|
||||
parser.add_argument("--schema-file", type=str, help="Path to a custom IFC schema, used with --schema-name")
|
||||
parser.add_argument("--schema-name", type=str, help="The name of a custom IFC schema, used with --schema-file")
|
||||
parser.add_argument("--lang", type=str, help="Specify a language e.g. en/de/fr/it", default="")
|
||||
|
||||
args = vars(parser.parse_args())
|
||||
|
||||
if args["action"] == "run":
|
||||
report_json = bimtester.run.TestRunner(args["ifc"], schema=args["schema"] or None).run(args)
|
||||
report_json = bimtester.run.TestRunner(args["ifc"]).run(args)
|
||||
if args["report"]:
|
||||
bimtester.reports.ReportGenerator().generate(report_json, args["report"])
|
||||
elif args["action"] == "purge":
|
||||
|
||||
@@ -28,7 +28,8 @@ class ExecuteBIMTester(bpy.types.Operator):
|
||||
"ifc": props.ifc_file,
|
||||
"path": "",
|
||||
"report": report,
|
||||
"schema": "",
|
||||
"schema_file": "",
|
||||
"schema_name": "",
|
||||
"lang": "en",
|
||||
"steps": props.steps
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user