mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +00:00
Create argument to specify a single feature in BIMTester, and separate report generation into its own function
This commit is contained in:
@@ -14,13 +14,11 @@ import re
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
def run_tests(args):
|
def run_tests(args):
|
||||||
behave_args = ['features', '--junit', '--junit-directory', args.junit_directory]
|
behave_args = [args.feature, '--junit', '--junit-directory', args.junit_directory]
|
||||||
if args.advanced_arguments:
|
if args.advanced_arguments:
|
||||||
behave_args = args.advanced_arguments.split()
|
behave_args = args.advanced_arguments.split()
|
||||||
behave_main(behave_args)
|
behave_main(behave_args)
|
||||||
print('# All tests are finished.')
|
print('# All tests are finished.')
|
||||||
if args.report:
|
|
||||||
generate_report(args)
|
|
||||||
|
|
||||||
def generate_report(args):
|
def generate_report(args):
|
||||||
print('# Generating HTML reports now.')
|
print('# Generating HTML reports now.')
|
||||||
@@ -31,6 +29,7 @@ def generate_report(args):
|
|||||||
for file in os.listdir(args.junit_directory):
|
for file in os.listdir(args.junit_directory):
|
||||||
if not file.endswith('.xml'):
|
if not file.endswith('.xml'):
|
||||||
continue
|
continue
|
||||||
|
print(f'Processing {file} ...')
|
||||||
root = ET.parse('{}{}'.format(args.junit_directory, file)).getroot()
|
root = ET.parse('{}{}'.format(args.junit_directory, file)).getroot()
|
||||||
data = {
|
data = {
|
||||||
'report_name': root.get('name'),
|
'report_name': root.get('name'),
|
||||||
@@ -117,6 +116,12 @@ parser.add_argument(
|
|||||||
type=str,
|
type=str,
|
||||||
help='Specify your own JUnit directory',
|
help='Specify your own JUnit directory',
|
||||||
default='junit/')
|
default='junit/')
|
||||||
|
parser.add_argument(
|
||||||
|
'-f',
|
||||||
|
'--feature',
|
||||||
|
type=str,
|
||||||
|
help='Specify a feature to test',
|
||||||
|
default='features')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-a',
|
'-a',
|
||||||
'--advanced-arguments',
|
'--advanced-arguments',
|
||||||
@@ -133,6 +138,8 @@ if not os.path.exists('features'):
|
|||||||
|
|
||||||
if args.purge:
|
if args.purge:
|
||||||
TestPurger().purge()
|
TestPurger().purge()
|
||||||
|
elif args.report:
|
||||||
|
generate_report(args)
|
||||||
else:
|
else:
|
||||||
run_tests(args)
|
run_tests(args)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user