-
-
Save berndhahnebach/2774f553643c275f8a8e912a426e413d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
import sys | |
sys.path.append("/home/hugo/Desktop/zeug/ifcos_bimtester/bimtester/") | |
import importlib | |
import mybimtester | |
importlib.reload(mybimtester) | |
mybimtester.run_tests() | |
mybimtester.generate_report() | |
""" | |
from behave.__main__ import main as behave_main | |
import os | |
import shutil | |
import time | |
BIMTESTER_PATH = "/home/hugo/Documents/dev/ifcopenshell/ifcopenshell-official/ifcos/src/ifcbimtester/" | |
def run_tests(args={}): | |
# set up data | |
original_steps_path = os.path.join(BIMTESTER_PATH, "features", "steps") | |
current_path = os.path.abspath(".") | |
features_path = os.path.join(current_path, "features") | |
steps_path = os.path.join(features_path, "steps") | |
if os.path.isdir(steps_path): | |
shutil.rmtree(steps_path) | |
time.sleep(1) | |
if os.path.exists(original_steps_path): | |
shutil.copytree(original_steps_path, steps_path) | |
# get args | |
behave_args = [features_path] | |
if 'advanced_arguments' in args: | |
behave_args.extend(args['advanced_arguments'].split()) | |
elif not 'console' in args: | |
behave_args.extend(['--format', 'json.pretty', '--outfile', 'report/report.json']) | |
# print(behave_args) | |
# run | |
behave_main(behave_args) | |
print('# All tests are finished.') | |
shutil.rmtree(steps_path) | |
return True | |
def generate_report(): | |
import sys | |
sys.path.append(BIMTESTER_PATH) | |
import bimtester | |
bimtester.generate_report() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment