2020-07-31 16:12:14 +10:00
|
|
|
#!/usr/bin/env python3
|
2020-11-23 09:34:13 +01:00
|
|
|
|
|
|
|
|
# Bernd: IMHO, this should go one lever up,
|
|
|
|
|
# or all other code should go one level down
|
|
|
|
|
# https://stackoverflow.com/questions/16981921/relative-imports-in-python-3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ATM bimtester code is copied here for for the sake of convenience
|
|
|
|
|
# TODO bimtester should be installed in conjunction with ifcopenshell
|
|
|
|
|
# to /urs/local by make install
|
|
|
|
|
|
|
|
|
|
|
2020-04-02 18:38:42 +11:00
|
|
|
# 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`
|
2019-10-15 11:19:44 +11:00
|
|
|
|
2020-04-02 18:38:42 +11:00
|
|
|
|
2020-11-23 09:34:13 +01:00
|
|
|
import argparse
|
2019-11-15 15:43:33 +11:00
|
|
|
|
2020-11-23 09:34:13 +01:00
|
|
|
import clean
|
|
|
|
|
import reports
|
|
|
|
|
import run
|
2019-11-15 15:43:33 +11:00
|
|
|
|
2020-04-02 18:38:42 +11:00
|
|
|
|
2020-07-23 13:42:41 +10:00
|
|
|
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.add_argument(
|
|
|
|
|
"-a", "--advanced-arguments", type=str, help="Specify your own arguments to Python's Behave", default=""
|
|
|
|
|
)
|
|
|
|
|
args = vars(parser.parse_args())
|
|
|
|
|
|
|
|
|
|
if args["purge"]:
|
2020-11-23 09:34:13 +01:00
|
|
|
clean.TestPurger().purge()
|
2020-07-23 13:42:41 +10:00
|
|
|
elif args["report"]:
|
2020-11-23 09:34:13 +01:00
|
|
|
reports.generate_report()
|
2020-07-23 13:42:41 +10:00
|
|
|
else:
|
2020-11-23 09:34:13 +01:00
|
|
|
run.run_tests(args)
|
2020-07-23 13:42:41 +10:00
|
|
|
print("# All tasks are complete :-)")
|