From 47d88b8db2b73551ce08380df51f391a1968b920 Mon Sep 17 00:00:00 2001 From: Marko Mecina <marko.mecina@univie.ac.at> Date: Tue, 15 Feb 2022 13:32:43 +0100 Subject: [PATCH] update TST JSON converters --- Tst/json_to_barescript.py | 3 ++- Tst/json_to_csv.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Tst/json_to_barescript.py b/Tst/json_to_barescript.py index 9ef58a7..7015b93 100755 --- a/Tst/json_to_barescript.py +++ b/Tst/json_to_barescript.py @@ -31,7 +31,8 @@ def run(jfile, outfile): script += '# Specification Version: ' + data['_spec_version'] + '\n' script += '# Software Version: ' + data['_iasw_version'] + '\n' script += '# Author: UVIE\n# Date: {}\n'.format(date) - script += '#--------------------------------------------\n\n\n' + script += '#--------------------------------------------\n\n' + script += '# COMMENT: {}\n\n\n'.format(data['_comment']) script += '# Precond.\n# {}\n'.format(data['_precon_descr']) # script += '{}\n\n\n'.format(data['_precon_code'].strip()) # Add the precondition code diff --git a/Tst/json_to_csv.py b/Tst/json_to_csv.py index 57723b8..cb57d96 100755 --- a/Tst/json_to_csv.py +++ b/Tst/json_to_csv.py @@ -17,6 +17,7 @@ def run(jfile, outfile): name = '{}|{}|Test spec. version: {}| IASW-{}'.format(data['_name'], data['_description'], data['_spec_version'], data['_iasw_version']) # Date from last time the json file was changed + current date date = 'Date||{}|'.format(datetime.datetime.now().strftime('%Y-%m-%d')) + testcomment = 'Comment|{}||'.format(data['_comment']) precond = 'Precond.|{}||'.format(data['_precon_descr']) postcond = 'Postcond.|{}||'.format(data['_postcon_descr']) steps = [] @@ -34,7 +35,10 @@ def run(jfile, outfile): outfile = outfile + data['_name'] + '-' + '-'.join(data['_spec_version'].split('-')[-2:]) + '.csv_PIPE' with open(outfile, 'w') as fd: - buf = '\n'.join([header, name, date, precond] + steps + [postcond]) + if len(data['_comment']) != 0: + buf = '\n'.join([header, name, date, testcomment, precond] + steps + [postcond]) + else: + buf = '\n'.join([header, name, date, precond] + steps + [postcond]) buf = buf.replace('_', '\\_') fd.write(buf) -- GitLab