mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-07 04:46:25 +00:00
You can now specify a set of custom step definitions to BIMTester.
This commit is contained in:
@@ -3,8 +3,13 @@ import sys
|
||||
import shutil
|
||||
import tempfile
|
||||
import ifcopenshell
|
||||
try:
|
||||
import ifcopenshell.express
|
||||
except:
|
||||
pass # They are using an old version of IfcOpenShell. Gracefully degrade for now.
|
||||
import behave.formatter.pretty # Needed for pyinstaller to package it
|
||||
from bimtester.ifc import IfcStore
|
||||
from distutils.dir_util import copy_tree
|
||||
from behave.__main__ import main as behave_main
|
||||
|
||||
|
||||
@@ -14,7 +19,6 @@ class TestRunner:
|
||||
IfcStore.file = ifc if ifc else ifcopenshell.open(ifc_path)
|
||||
|
||||
if schema:
|
||||
import ifcopenshell.express
|
||||
schema = ifcopenshell.express.parse(path)
|
||||
ifcopenshell.register_schema(schema)
|
||||
|
||||
@@ -29,9 +33,15 @@ class TestRunner:
|
||||
def run(self, args):
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
features_path = os.path.join(tmpdir, "features")
|
||||
steps_path = os.path.join(features_path, "steps")
|
||||
report_json = os.path.join(tmpdir, "report.json")
|
||||
shutil.copytree(os.path.join(self.base_path, "features"), features_path)
|
||||
shutil.copy(args["feature"], features_path)
|
||||
if args["steps"]:
|
||||
if os.path.isfile(args["steps"]):
|
||||
shutil.copy(args["steps"], steps_path)
|
||||
elif os.path.isdir(args["steps"]):
|
||||
copy_tree(args["steps"], steps_path)
|
||||
behave_main(self.get_behave_args(args, features_path, report_json))
|
||||
return report_json
|
||||
|
||||
|
||||
Executable → Regular
+1
@@ -14,6 +14,7 @@ parser.add_argument("-f", "--feature", type=str, help="Specify a feature file to
|
||||
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("-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="")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user