diff --git a/src/ifcbimtester/README.md b/src/ifcbimtester/README.md new file mode 100644 index 0000000000..a02d4bf267 --- /dev/null +++ b/src/ifcbimtester/README.md @@ -0,0 +1,18 @@ +# BIMTester +### Packages to be installed ++ behave ++ pystache ++ ifcopenshell + + +### Start bimtester Gui from a shell +``` +python3 ./bimtester.py -g +``` + +### Create a binary out of the Python package ++ The commands needs to be updated ++ Unix: +`$ pyinstaller --onefile --clean --icon=icon.ico --add-data "features:features" bimtester.py` ++ Windows: + `$ pyinstaller --onefile --clean --icon=icon.ico --add-data "features;features" bimtester.py` diff --git a/src/ifcbimtester/bimtester.py b/src/ifcbimtester/bimtester.py index c33121b6fd..1847126024 100644 --- a/src/ifcbimtester/bimtester.py +++ b/src/ifcbimtester/bimtester.py @@ -1,10 +1,5 @@ #!/usr/bin/env python3 -# Unix: -# $ pyinstaller --onefile --clean --icon=icon.ico --add-data "features:features" bimtester.py` -# Windows: -# $ pyinstaller --onefile --clean --icon=icon.ico --add-data "features;features" bimtester.py` - import argparse from bimtester import clean @@ -12,14 +7,66 @@ from bimtester import reports from bimtester import run +def show_widget(): + + import sys + from PySide2 import QtWidgets + + from bimtester.guiwidget import GuiWidgetBimTester + + # Create the Qt Application + app = QtWidgets.QApplication(sys.argv) + + # Create and show the form + form = GuiWidgetBimTester() + form.show() + + # Run the main Qt loop + sys.exit(app.exec_()) + + if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Runs unit tests for BIM data") - parser.add_argument("-p", "--purge", action="store_true", help="Purge tests of deleted elements") - parser.add_argument("-r", "--report", action="store_true", help="Generate a HTML report") - 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", default="") + + parser = argparse.ArgumentParser( + description="Runs unit tests for BIM data" + ) parser.add_argument( - "-a", "--advanced-arguments", type=str, help="Specify your own arguments to Python's Behave", default="" + "-p", + "--purge", + action="store_true", + help="Purge tests of deleted elements" + ) + parser.add_argument( + "-r", + "--report", + action="store_true", + help="Generate a HTML report" + ) + 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", + default="" + ) + parser.add_argument( + "-a", + "--advanced-arguments", + type=str, + help="Specify your own arguments to Python's Behave", + default="" + ) + parser.add_argument( + "-g", + "--gui", + action="store_true", + help="Start with gui", ) args = vars(parser.parse_args()) @@ -27,6 +74,8 @@ if __name__ == "__main__": clean.TestPurger().purge() elif args["report"]: reports.generate_report() + elif args["gui"]: + show_widget() else: run.run_tests(args) print("# All tasks are complete :-)") diff --git a/src/ifcbimtester/bimtester/features/steps/classification.py b/src/ifcbimtester/bimtester/features/steps/classification.py index 40f2201252..3ed1e8d35a 100644 --- a/src/ifcbimtester/bimtester/features/steps/classification.py +++ b/src/ifcbimtester/bimtester/features/steps/classification.py @@ -1,6 +1,9 @@ import json from behave import step -from utils import IfcFile, assert_attribute, assert_type + +from utils import assert_attribute +from utils import assert_type +from utils import IfcFile def get_classification(name): diff --git a/src/ifcbimtester/bimtester/features/steps/element_classes.py b/src/ifcbimtester/bimtester/features/steps/element_classes.py index a3908ce2b6..07ea37ffce 100644 --- a/src/ifcbimtester/bimtester/features/steps/element_classes.py +++ b/src/ifcbimtester/bimtester/features/steps/element_classes.py @@ -1,5 +1,8 @@ from behave import step -from utils import IfcFile, assert_attribute, assert_type + +from utils import assert_attribute +from utils import assert_type +from utils import IfcFile @step("The element {guid} is an {ifc_class} only") diff --git a/src/ifcbimtester/bimtester/features/steps/project_setup.py b/src/ifcbimtester/bimtester/features/steps/project_setup.py index c8abb39ca2..14fc480fa3 100644 --- a/src/ifcbimtester/bimtester/features/steps/project_setup.py +++ b/src/ifcbimtester/bimtester/features/steps/project_setup.py @@ -1,6 +1,7 @@ from behave import step + +from utils import assert_attribute from utils import IfcFile -from utils import IfcFile, assert_attribute @step('The IFC file "{file}" must be provided') diff --git a/src/ifcbimtester/bimtester/features/steps/steps.py b/src/ifcbimtester/bimtester/features/steps/steps.py index 4d48bde68e..8627efd419 100644 --- a/src/ifcbimtester/bimtester/features/steps/steps.py +++ b/src/ifcbimtester/bimtester/features/steps/steps.py @@ -1,4 +1,5 @@ from behave import step + from utils import IfcFile diff --git a/src/ifcbimtester/bimtester/run.py b/src/ifcbimtester/bimtester/run.py index c64c54372f..4d4cbea046 100644 --- a/src/ifcbimtester/bimtester/run.py +++ b/src/ifcbimtester/bimtester/run.py @@ -107,6 +107,25 @@ run.run_all(myfeatures_path, myfeatures_path) # like German Umlaute behave gives an error +# TODO: change run_intmp_tests() and run_all() +# arguments feature_path and ifc_file +# +# both is given: +# replace the ifc in feature files +# +# feature_path only is given: +# use the ifc provided in the feature files +# +# ifc_file only is given: +# assume feature files are in the directory of the ifc +# +# none of both is given: +# use current directory and the ifc from feature files + + +# TODO: add arg for run_intmp_tests() to bimtester.py + + def run_intmp_tests(args={}): from behave import __version__ as behave_version diff --git a/src/ifcbimtester/guibimtester.py b/src/ifcbimtester/guibimtester.py deleted file mode 100644 index 000e4507a9..0000000000 --- a/src/ifcbimtester/guibimtester.py +++ /dev/null @@ -1,22 +0,0 @@ -# TODO merge into bimtester module - -import sys -from PySide2 import QtWidgets - -from bimtester.guiwidget import GuiWidgetBimTester - - -def show_widget(): - - # Create the Qt Application - app = QtWidgets.QApplication(sys.argv) - - # Create and show the form - form = GuiWidgetBimTester() - form.show() - - # Run the main Qt loop - sys.exit(app.exec_()) - -if __name__ == '__main__': - show_widget()