Fix BIMTester file overwrite bug and template re-reading.

This commit is contained in:
Dion Moult
2019-10-23 13:28:18 +11:00
parent d3ccd9ee61
commit e5efa2803a
+2 -1
View File
@@ -11,7 +11,7 @@ import sys
def run_tests(): def run_tests():
behave_main(['features', '--junit', '--junit-directory', 'junit/']) behave_main(['features', '--junit', '--junit-directory', 'junit/'])
print('# All tests have finished. Generating HTML reports now.') print('# All tests have finished. Generating HTML reports now.')
with open('features/template.html') as template: if not os.path.exists('report'):
os.mkdir('report') os.mkdir('report')
for file in os.listdir('junit/'): for file in os.listdir('junit/'):
if not file.endswith('.xml'): if not file.endswith('.xml'):
@@ -41,6 +41,7 @@ def run_tests():
'total_steps': len(steps) 'total_steps': len(steps)
}) })
with open('report/{}.html'.format(file[0:-4]), 'w') as out: with open('report/{}.html'.format(file[0:-4]), 'w') as out:
with open('features/template.html') as template:
out.write(pystache.render(template.read(), data)) out.write(pystache.render(template.read(), data))