diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2016-06-15 17:42:59 +0200 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2016-06-15 17:42:59 +0200 |
commit | 10c1f99f8d16196e2898c11f9b5c1d3f0735807a (patch) | |
tree | 00d84594e153ad3163e10f8171188342a5c1fd50 /testcases/Controllers/ODL/odlreport2db.py | |
parent | 2a06283642676194b0bb4ed9cc20fe54005765a5 (diff) |
Try/except ODL push to DB until ODL tests are refactored
Change-Id: I7919c69655ce43831d5269afc1d86bf2c929bb8f
Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'testcases/Controllers/ODL/odlreport2db.py')
-rw-r--r-- | testcases/Controllers/ODL/odlreport2db.py | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/testcases/Controllers/ODL/odlreport2db.py b/testcases/Controllers/ODL/odlreport2db.py index 3eff40060..075de5a86 100644 --- a/testcases/Controllers/ODL/odlreport2db.py +++ b/testcases/Controllers/ODL/odlreport2db.py @@ -110,17 +110,17 @@ def main(argv): # dictionary populated with data from xml file all_data = xmltodict.parse(xml_input)['robot'] - data = parse_suites(all_data['suite']['suite']) - data['description'] = all_data['suite']['@name'] - data['version'] = all_data['@generator'] - data['test_project'] = "functest" - data['case_name'] = "ODL" - data['pod_name'] = pod - data['installer'] = installer + try: + data = parse_suites(all_data['suite']['suite']) + data['description'] = all_data['suite']['@name'] + data['version'] = all_data['@generator'] + data['test_project'] = "functest" + data['case_name'] = "ODL" + data['pod_name'] = pod + data['installer'] = installer - json.dumps(data, indent=4, separators=(',', ': ')) + json.dumps(data, indent=4, separators=(',', ': ')) - try: # example: # python odlreport2db.py -x ~/Pictures/Perso/odl/output3.xml # -i fuel @@ -133,19 +133,16 @@ def main(argv): # start and stoptime have no real meaning start_time = time.time() stop_time = start_time - try: - tests_passed = 0 - tests_failed = 0 - for v in data['details']: - if v['test_status']['@status'] == "PASS": - tests_passed += 1 - else: - tests_failed += 1 - - if (tests_failed < 1): - status = "PASS" - except: - print("Unable to set criteria" % sys.exc_info()[0]) + tests_passed = 0 + tests_failed = 0 + for v in data['details']: + if v['test_status']['@status'] == "PASS": + tests_passed += 1 + else: + tests_failed += 1 + + if (tests_failed < 1): + status = "PASS" functest_utils.push_results_to_db("functest", data['case_name'], @@ -156,7 +153,7 @@ def main(argv): data) except: - print("Error pushing results into Database '%s'" % sys.exc_info()[0]) + print("Error pushing ODL results into DB '%s'" % sys.exc_info()[0]) if __name__ == "__main__": |